Unconditionally include <config.h> in unit tests.
[gnulib.git] / tests / test-crc.c
1 /*
2  * Copyright (C) 2005, 2006, 2007 Free Software Foundation
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 #include <config.h>
22
23 #include "crc.h"
24
25 #include <stdio.h>
26
27 int
28 main (int argc, char *argv[])
29 {
30   uint32_t p;
31
32   p = crc32_update_no_xor (42, "foo", 3);
33   if (p != 0x46e87f05)
34     {
35       printf ("cunx got %lx\n", (unsigned long) p);
36       return 1;
37     }
38
39   p = crc32_no_xor ("foo", 3);
40   if (p != 0x7332bc33)
41     {
42       printf ("cnx got %lx\n", (unsigned long) p);
43       return 1;
44     }
45
46   p = crc32_update (42, "foo", 3);
47   if (p != 0xb9a9a617)
48     {
49       printf ("cu got %lx\n", (unsigned long) p);
50       return 1;
51     }
52
53   p = crc32 ("foo", 3);
54   if (p != 0x8c736521)
55     {
56       printf ("c got %lx\n", (unsigned long) p);
57       return 1;
58     }
59
60   return 0;
61 }