test-hash: Make check_256byte_hash() test no 1-bits set case.
authorAlex Wang <alexw@nicira.com>
Wed, 25 Feb 2015 23:08:51 +0000 (15:08 -0800)
committerAlex Wang <alexw@nicira.com>
Fri, 27 Feb 2015 05:12:43 +0000 (21:12 -0800)
The test comment mentions that we will test the no 1-bits set case.
So, this commit makes sure that it is tested.

Signed-off-by: Alex Wang <alexw@nicira.com>
---
PATCH->V2:
- explain why calling set_bit128 with i or j == n_bits is okay.

tests/test-hash.c

index d7e2e6b..e71de67 100644 (file)
@@ -151,8 +151,8 @@ check_256byte_hash(void (*hash)(const void *, size_t, uint32_t, ovs_u128 *),
     const int n_bits = 256 * 8;
     int i, j;
 
-    for (i = 0; i < n_bits; i++) {
-        for (j = i + 1; j < n_bits; j++) {
+    for (i = 0; i <= n_bits; i++) {
+        for (j = i + 1; j <= n_bits; j++) {
             OVS_PACKED(struct offset_ovs_u128 {
                 uint32_t a;
                 ovs_u128 b[16];
@@ -161,6 +161,8 @@ check_256byte_hash(void (*hash)(const void *, size_t, uint32_t, ovs_u128 *),
             ovs_u128 out0, out1, out2;
 
             in0 = in0_data.b;
+            /* When, i or j == n_bits, the set_bit128() will just
+            * zero set the input variables. */
             set_bit128(in0, i);
             set_bit128(in1, i);
             set_bit128(in2, j);