[PATCH 1/2] test: compare byte padding macros against the expected bytes.

Peter Hutterer peter.hutterer at who-t.net
Wed Mar 24 20:30:37 PDT 2010


We calculate the expected bytes for each value, let's use it.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/input.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/test/input.c b/test/input.c
index 63d1a18..f6aef81 100644
--- a/test/input.c
+++ b/test/input.c
@@ -693,6 +693,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
+        g_assert(expected_bytes == bits_to_bytes(i));
     }
 
     g_test_message("Testing bytes_to_int32()");
@@ -703,6 +704,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
+        g_assert(expected_4byte == bytes_to_int32(i));
     }
 
     g_test_message("Testing pad_to_int32");
@@ -714,6 +716,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
+        g_assert(expected_bytes == pad_to_int32(i));
     }
 
 }
-- 
1.6.6.1


More information about the xorg-devel mailing list