Mercurial > hg > octave-lojdl > gnulib-hg
annotate tests/test-crc.c @ 6935:c7a96bfc8c0e
2006-07-07 Simon Josefsson <jas@extundo.com>
* tests/test-crc.c: Change expected crc value, the test vector
were probably computed using the old broken crc.c?
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Thu, 06 Jul 2006 23:56:00 +0000 |
parents | 9abdb1386cc0 |
children | 260df799e469 |
rev | line source |
---|---|
6357 | 1 /* |
6935
c7a96bfc8c0e
2006-07-07 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents:
6357
diff
changeset
|
2 * Copyright (C) 2005, 2006 Free Software Foundation |
6357 | 3 * |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2, or (at your option) | |
7 * any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
17 * 02110-1301, USA. */ | |
18 | |
19 /* Written by Simon Josefsson. */ | |
20 | |
21 #ifdef HAVE_CONFIG_H | |
22 # include <config.h> | |
23 #endif | |
24 | |
25 #include "crc.h" | |
26 | |
27 #include <stdio.h> | |
28 | |
29 int | |
30 main (int argc, char *argv[]) | |
31 { | |
32 uint32_t p; | |
33 | |
34 p = crc32_update_no_xor (42, "foo", 3); | |
35 if (p != 0x46e87f05) | |
36 { | |
37 printf ("cunx got %lx\n", p); | |
38 return 1; | |
39 } | |
40 | |
41 p = crc32_no_xor ("foo", 3); | |
42 if (p != 0x7332bc33) | |
43 { | |
44 printf ("cnx got %lx\n", p); | |
45 return 1; | |
46 } | |
47 | |
48 p = crc32_update (42, "foo", 3); | |
6935
c7a96bfc8c0e
2006-07-07 Simon Josefsson <jas@extundo.com>
Simon Josefsson <simon@josefsson.org>
parents:
6357
diff
changeset
|
49 if (p != 0xb9a9a617) |
6357 | 50 { |
51 printf ("cu got %lx\n", p); | |
52 return 1; | |
53 } | |
54 | |
55 p = crc32 ("foo", 3); | |
56 if (p != 0x8c736521) | |
57 { | |
58 printf ("c got %lx\n", p); | |
59 return 1; | |
60 } | |
61 | |
62 return 0; | |
63 } |