test-csum: Make test_case requirements clear.
authorBen Pfaff <blp@nicira.com>
Tue, 16 Nov 2010 20:51:08 +0000 (12:51 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 16 Nov 2010 20:51:08 +0000 (12:51 -0800)
This test code only works properly with test cases whose data is a multiple
of 4, so make that clear in the code and the data.

tests/test-csum.c

index eebc880..fd16dd3 100644 (file)
@@ -29,7 +29,7 @@
 
 struct test_case {
     char *data;
-    size_t size;
+    size_t size;                /* Test requires a multiple of 4. */
     uint16_t csum;
 };
 
@@ -37,15 +37,22 @@ struct test_case {
 
 static const struct test_case test_cases[] = {
     /* RFC 1071 section 3. */
-    TEST_CASE("\x00\x01\xf2\x03\xf4\xf5\xf6\xf7", (uint16_t) ~0xddf2),
+    TEST_CASE("\x00\x01\xf2\x03"
+              "\xf4\xf5\xf6\xf7",
+              (uint16_t) ~0xddf2),
 
     /* http://www.sbprojects.com/projects/tcpip/theory/theory14.htm */
-    TEST_CASE("\x45\x00\x00\x28\x1F\xFD\x40\x00\x80\x06"
-              "\x00\x00\xC0\xA8\x3B\x0A\xC0\xA8\x3B\x32",
+    TEST_CASE("\x45\x00\x00\x28"
+              "\x1F\xFD\x40\x00"
+              "\x80\x06\x00\x00"
+              "\xC0\xA8\x3B\x0A"
+              "\xC0\xA8\x3B\x32",
               0xe345),
 
     /* http://mathforum.org/library/drmath/view/54379.html */
-    TEST_CASE("\x86\x5e\xac\x60\x71\x2a\x81\xb5", 0xda60),
+    TEST_CASE("\x86\x5e\xac\x60"
+              "\x71\x2a\x81\xb5",
+              0xda60),
 };
 
 static void