Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1395)

Side by Side Diff: src/platform/vboot_reference/cgptlib/tests/crc32_test.c

Issue 2082015: add cgpt framework and attribute support. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 * found in the LICENSE file.
4 */
5
6 #include "crc32_test.h"
7 #include "cgptlib_test.h"
8 #include "crc32.h"
9 #include "utility.h"
10
11 #define MAX_VECTOR_LEN 256
12
13 int TestCrc32TestVectors() {
14 struct {
15 uint8_t vector[MAX_VECTOR_LEN];
16 int len;
17 uint32_t crc32;
18 } cases[] = {
19 {{0x00}, 1, 0xD202EF8D},
20 {{0x00, 0x00, 0x00, 0x00}, 4, 0x2144DF1C},
21 {{0x01, 0x01, 0x01, 0x01}, 4, 0xF626D399},
22 {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
23 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
24 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
25 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
26 0x00,0x00,0x00,0x28,0x86,0x4d,0x7f,0x99}, 48, 0x923D6EFD},
27 {{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
28 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
29 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
30 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
31 0x00,0x00,0x00,0x28,0xc5,0x5e,0x45,0x7a}, 48, 0x49A04D82},
32 {{0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,
33 0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,
34 0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,
35 0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,
36 0x00,0x00,0x00,0x28,0xbf,0x67,0x1e,0xd0}, 48, 0x688B3BFA},
37 };
38 int i;
39
40 for (i = 0; i < ARRAY_SIZE(cases); ++i) {
41 uint32_t crc32;
42
43 crc32 = Crc32(cases[i].vector, cases[i].len);
44 EXPECT(crc32 == cases[i].crc32);
45 }
46 return TEST_OK;
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698