OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 #include "crc32_test.h" | 6 #include "crc32_test.h" |
7 #include "cgptlib_test.h" | 7 #include "cgptlib_test.h" |
8 #include "crc32.h" | 8 #include "crc32.h" |
| 9 #include "test_common.h" |
9 #include "utility.h" | 10 #include "utility.h" |
10 | 11 |
11 #define MAX_VECTOR_LEN 256 | 12 #define MAX_VECTOR_LEN 256 |
12 | 13 |
13 int TestCrc32TestVectors() { | 14 int TestCrc32TestVectors() { |
14 struct { | 15 struct { |
15 uint8_t vector[MAX_VECTOR_LEN]; | 16 uint8_t vector[MAX_VECTOR_LEN]; |
16 int len; | 17 int len; |
17 uint32_t crc32; | 18 uint32_t crc32; |
18 } cases[] = { | 19 } cases[] = { |
(...skipping 19 matching lines...) Expand all Loading... |
38 int i; | 39 int i; |
39 | 40 |
40 for (i = 0; i < ARRAY_SIZE(cases); ++i) { | 41 for (i = 0; i < ARRAY_SIZE(cases); ++i) { |
41 uint32_t crc32; | 42 uint32_t crc32; |
42 | 43 |
43 crc32 = Crc32(cases[i].vector, cases[i].len); | 44 crc32 = Crc32(cases[i].vector, cases[i].len); |
44 EXPECT(crc32 == cases[i].crc32); | 45 EXPECT(crc32 == cases[i].crc32); |
45 } | 46 } |
46 return TEST_OK; | 47 return TEST_OK; |
47 } | 48 } |
OLD | NEW |