diff options
author | Max Horn | 2011-04-12 17:23:32 +0200 |
---|---|---|
committer | Max Horn | 2011-04-12 17:23:32 +0200 |
commit | 65fc72e30a885f6adca99505ee869e010f94c1c3 (patch) | |
tree | 668cbbe3ae45fc331a3a11148565f03f058aa95a | |
parent | f1471689cf6b11412da0d8d09526a558ff33e9d0 (diff) | |
download | scummvm-rg350-65fc72e30a885f6adca99505ee869e010f94c1c3.tar.gz scummvm-rg350-65fc72e30a885f6adca99505ee869e010f94c1c3.tar.bz2 scummvm-rg350-65fc72e30a885f6adca99505ee869e010f94c1c3.zip |
COMMON: Add some testcases for common/endian.h
-rw-r--r-- | test/common/endian.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/common/endian.h b/test/common/endian.h new file mode 100644 index 0000000000..cba7618c43 --- /dev/null +++ b/test/common/endian.h @@ -0,0 +1,36 @@ +#include <cxxtest/TestSuite.h> +#include "common/endian.h" + +class EndianTestSuite : public CxxTest::TestSuite +{ + public: + void test_MKTAG() { + const char *str_tag = "ABCD"; + uint32 tag = READ_BE_UINT32(str_tag); + TS_ASSERT_EQUALS(MKTAG('A','B','C','D'), tag); + } + + void test_READ_BE_UINT32() { + const char data[4] = { 0x12, 0x34, 0x56, 0x78 }; + uint32 value = READ_BE_UINT32(data); + TS_ASSERT_EQUALS(value, 0x12345678UL); + } + + void test_READ_LE_UINT32() { + const char data[4] = { 0x12, 0x34, 0x56, 0x78 }; + uint32 value = READ_LE_UINT32(data); + TS_ASSERT_EQUALS(value, 0x78563412UL); + } + + void test_READ_BE_UINT16() { + const char data[4] = { 0x12, 0x34, 0x56, 0x78 }; + uint32 value = READ_BE_UINT16(data); + TS_ASSERT_EQUALS(value, 0x1234UL); + } + + void test_READ_LE_UINT16() { + const char data[4] = { 0x12, 0x34, 0x56, 0x78 }; + uint32 value = READ_LE_UINT16(data); + TS_ASSERT_EQUALS(value, 0x3412UL); + } +}; |