aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test/input.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
committermarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
commitd137057fd13e83ec15ab416c7fe774741da06047 (patch)
treef4b38caa4f3ecb983f00e84f4f4d8d66699ecbc5 /xorg-server/test/input.c
parentc29d91cfd8df084f16d0d2dfa82c3a86f7719a73 (diff)
downloadvcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.gz
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.bz2
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.zip
fontconfig mesa xserver git update 10 Jul 2012
Diffstat (limited to 'xorg-server/test/input.c')
-rw-r--r--xorg-server/test/input.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index 90ab9aea3..191c81789 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -965,6 +965,19 @@ test_pad_to_int32(int i)
}
static void
+test_padding_for_int32(int i)
+{
+ static const int padlength[4] = { 0, 3, 2, 1 };
+ int expected_bytes = (((i + 3) / 4) * 4) - i;
+
+ assert(padding_for_int32(i) >= 0);
+ assert(padding_for_int32(i) <= 3);
+ assert(padding_for_int32(i) == expected_bytes);
+ assert(padding_for_int32(i) == padlength[i & 3]);
+ assert((padding_for_int32(i) + i) == pad_to_int32(i));
+}
+
+static void
include_byte_padding_macros(void)
{
printf("Testing bits_to_bytes()\n");
@@ -996,12 +1009,12 @@ include_byte_padding_macros(void)
test_bytes_to_int32(INT_MAX - 4);
test_bytes_to_int32(INT_MAX - 3);
- printf("Testing pad_to_int32\n");
+ printf("Testing pad_to_int32()\n");
test_pad_to_int32(0);
- test_pad_to_int32(0);
test_pad_to_int32(1);
test_pad_to_int32(2);
+ test_pad_to_int32(3);
test_pad_to_int32(7);
test_pad_to_int32(8);
test_pad_to_int32(0xFF);
@@ -1012,6 +1025,23 @@ include_byte_padding_macros(void)
test_pad_to_int32(0x1000000);
test_pad_to_int32(INT_MAX - 4);
test_pad_to_int32(INT_MAX - 3);
+
+ printf("Testing padding_for_int32()\n");
+
+ test_padding_for_int32(0);
+ test_padding_for_int32(1);
+ test_padding_for_int32(2);
+ test_padding_for_int32(3);
+ test_padding_for_int32(7);
+ test_padding_for_int32(8);
+ test_padding_for_int32(0xFF);
+ test_padding_for_int32(0x100);
+ test_padding_for_int32(0xFFFF);
+ test_padding_for_int32(0x10000);
+ test_padding_for_int32(0xFFFFFF);
+ test_padding_for_int32(0x1000000);
+ test_padding_for_int32(INT_MAX - 4);
+ test_padding_for_int32(INT_MAX - 3);
}
static void