< prev index next >

test/hotspot/gtest/runtime/test_os.cpp

Print this page

        

@@ -182,12 +182,11 @@
     sizeof(buffer)/4,                    // Doesn't fit.
     sizeof(expected) + padding_size + 1, // Fits, with a little room to spare
     sizeof(expected) + padding_size,     // Fits exactly.
     sizeof(expected) + padding_size - 1, // Doesn't quite fit.
     2,                                   // One char + terminating NUL.
-    1,                                   // Only space for terminating NUL.
-    0 };                                 // No space at all.
+    1};                                  // Only space for terminating NUL.
   for (unsigned i = 0; i < ARRAY_SIZE(sizes_to_test); ++i) {
     memset(buffer, check_char, sizeof(buffer)); // To catch stray writes.
     size_t test_size = sizes_to_test[i];
     ResourceMark rm;
     stringStream s;

@@ -203,29 +202,18 @@
     int result = pf(write_start, test_size, "%s", expected);
 
     check_snprintf_result(expected_len, test_size, result, expect_count);
 
     // Verify expected output.
-    if (test_size > 0) {
       ASSERT_EQ(0, strncmp(write_start, expected, write_size - 1));
       // Verify terminating NUL of output.
       ASSERT_EQ('\0', write_start[write_size - 1]);
-    } else {
-      guarantee(test_size == 0, "invariant");
-      guarantee(write_size == 0, "invariant");
-      guarantee(prefix_size + suffix_size == sizeof(buffer), "invariant");
-      guarantee(write_start == write_end, "invariant");
-    }
 
     // Verify no scribbling on prefix or suffix.
     ASSERT_EQ(0, strncmp(buffer, check_buffer, prefix_size));
     ASSERT_EQ(0, strncmp(write_end, check_buffer, suffix_size));
   }
-
-  // Special case of 0-length buffer with empty (except for terminator) output.
-  check_snprintf_result(0, 0, pf(NULL, 0, "%s", ""), expect_count);
-  check_snprintf_result(0, 0, pf(NULL, 0, ""), expect_count);
 }
 
 // This is probably equivalent to os::snprintf, but we're being
 // explicit about what we're testing here.
 static int vsnprintf_wrapper(char* buf, size_t len, const char* fmt, ...) {
< prev index next >