cmake: use extra compiler warnings only on gcc6+
[project/fwtool.git] / tests / test-crc32.c
1 #include <stdio.h>
2
3 #include "crc32.h"
4 #include "utils.h"
5
6 static uint32_t crc_table[256];
7
8 int main()
9 {
10 uint32_t crc32 = ~0;
11 uint8_t all_ones[1<<10] = { 1 };
12 uint8_t all_ffs[1<<5] = { 0xff };
13 uint8_t all_7fs[1<<15] = { 0x7f };
14 uint8_t all_zeroes[1<<8] = { 0 };
15 uint8_t quick_fox[] = "The quick brown fox jumps over the lazy dog and then walks away.";
16
17 crc32_filltable(crc_table);
18
19 fprintf(stdout, "all_ffs=0x%x\n", cpu_to_be32(crc32_block(crc32, all_ffs, sizeof(all_ffs), crc_table)));
20 fprintf(stdout, "all_7fs=0x%x\n", cpu_to_be32(crc32_block(crc32, all_7fs, sizeof(all_7fs), crc_table)));
21 fprintf(stdout, "all_ones=0x%x\n", cpu_to_be32(crc32_block(crc32, all_ones, sizeof(all_ones), crc_table)));
22 fprintf(stdout, "all_zeroes=0x%x\n", cpu_to_be32(crc32_block(crc32, all_zeroes, sizeof(all_zeroes), crc_table)));
23 fprintf(stdout, "quick_fox=0x%x\n", cpu_to_be32(crc32_block(crc32, quick_fox, sizeof(quick_fox), crc_table)));
24
25 return 0;
26 }