diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2019-07-27 07:57:27 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2019-07-27 07:57:27 +0000 |
commit | d4a0bed4b91da9de86c311c7fef9a8aa9a6f500c (patch) | |
tree | a1b439049dee87bc951e190db93f5bbe8b43b0b5 /xserver/test/misc.c | |
parent | b6bc775539a31f663f9e22ce3ccaf0aa96adf3b6 (diff) |
Update to xserver 1.20.5. Tested by jsg@
Diffstat (limited to 'xserver/test/misc.c')
-rw-r--r-- | xserver/test/misc.c | 34 |
1 files changed, 33 insertions, 1 deletions
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; } |