1 ///////////////////////////////////////////////////////////////////////////////
4 /// \brief Tests integrity checks
8 // Author: Lasse Collin
10 // This file has been put into the public domain.
11 // You can do whatever you want with this file.
13 ///////////////////////////////////////////////////////////////////////////////
18 static const uint8_t test_string[9] = "123456789";
19 static const uint8_t test_unaligned[12] = "xxx123456789";
25 static const uint32_t test_vector = 0xCBF43926;
28 uint32_t crc = lzma_crc32(test_string, sizeof(test_string), 0);
29 if (crc != test_vector)
33 crc = lzma_crc32(test_unaligned + 3, sizeof(test_string), 0);
34 if (crc != test_vector)
39 for (size_t i = 0; i < sizeof(test_string); ++i)
40 crc = lzma_crc32(test_string + i, 1, crc);
41 if (crc != test_vector)
51 static const uint64_t test_vector = 0x995DC9BBDF1939FA;
54 uint64_t crc = lzma_crc64(test_string, sizeof(test_string), 0);
55 if (crc != test_vector)
59 crc = lzma_crc64(test_unaligned + 3, sizeof(test_string), 0);
60 if (crc != test_vector)
65 for (size_t i = 0; i < sizeof(test_string); ++i)
66 crc = lzma_crc64(test_string + i, 1, crc);
67 if (crc != test_vector)
79 error |= test_crc32();
80 error |= test_crc64();