From d4a0bed4b91da9de86c311c7fef9a8aa9a6f500c Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 27 Jul 2019 07:57:27 +0000 Subject: Update to xserver 1.20.5. Tested by jsg@ --- xserver/test/misc.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'xserver/test/misc.c') diff --git a/xserver/test/misc.c b/xserver/test/misc.c index 66330a140..3c669b677 100644 --- a/xserver/test/misc.c +++ b/xserver/test/misc.c @@ -31,6 +31,8 @@ #include "dix.h" #include "dixstruct.h" +#include "tests-common.h" + ScreenInfo screenInfo; static void @@ -190,13 +192,43 @@ dix_request_size_checks(void) assert(rc == Success); } +static void +bswap_test(void) +{ + const uint16_t test_16 = 0xaabb; + const uint16_t expect_16 = 0xbbaa; + const uint32_t test_32 = 0xaabbccdd; + const uint32_t expect_32 = 0xddccbbaa; + const uint64_t test_64 = 0x11223344aabbccddull; + const uint64_t expect_64 = 0xddccbbaa44332211ull; + uint16_t result_16; + uint32_t result_32; + uint64_t result_64; + + assert(bswap_16(test_16) == expect_16); + assert(bswap_32(test_32) == expect_32); + assert(bswap_64(test_64) == expect_64); + + result_16 = test_16; + swaps(&result_16); + assert(result_16 == expect_16); + + result_32 = test_32; + swapl(&result_32); + assert(result_32 == expect_32); + + result_64 = test_64; + swapll(&result_64); + assert(result_64 == expect_64); +} int -main(int argc, char **argv) +misc_test(void) { dix_version_compare(); dix_update_desktop_dimensions(); dix_request_size_checks(); + bswap_test(); return 0; } -- cgit v1.2.3