File tree 4 files changed +32
-16
lines changed
4 files changed +32
-16
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,14 @@ uint32_t adler32(const char* s)
36
36
*/
37
37
void test_adler32 ()
38
38
{
39
- assert (adler32 ("Hello World" ) == (const uint32_t )403375133 );
40
- assert (adler32 ("Hello World!" ) == (const uint32_t )474547262 );
41
- assert (adler32 ("Hello world" ) == (const uint32_t )413860925 );
42
- assert (adler32 ("Hello world!" ) == (const uint32_t )487130206 );
39
+ const uint32_t test1 = 403375133 ;
40
+ assert (adler32 ("Hello World" ) == test1 );
41
+ const uint32_t test2 = 474547262 ;
42
+ assert (adler32 ("Hello World!" ) == test2 );
43
+ const uint32_t test3 = 413860925 ;
44
+ assert (adler32 ("Hello world" ) == test3 );
45
+ const uint32_t test4 = 487130206 ;
46
+ assert (adler32 ("Hello world!" ) == test4 );
43
47
printf ("Tests passed\n" );
44
48
}
45
49
Original file line number Diff line number Diff line change @@ -38,10 +38,14 @@ uint32_t crc32(const char* s)
38
38
*/
39
39
void test_crc32 ()
40
40
{
41
- assert (crc32 ("Hello World" ) == (const uint32_t )1243066710 );
42
- assert (crc32 ("Hello World!" ) == (const uint32_t )472456355 );
43
- assert (crc32 ("Hello world" ) == (const uint32_t )2346098258 );
44
- assert (crc32 ("Hello world!" ) == (const uint32_t )461707669 );
41
+ const uint32_t test1 = 1243066710 ;
42
+ assert (crc32 ("Hello World" ) == test1 );
43
+ const uint32_t test2 = 472456355 ;
44
+ assert (crc32 ("Hello World!" ) == test2 );
45
+ const uint32_t test3 = 2346098258 ;
46
+ assert (crc32 ("Hello world" ) == test3 );
47
+ const uint32_t test4 = 461707669 ;
48
+ assert (crc32 ("Hello world!" ) == test4 );
45
49
// printf("%" PRIu32 "\n", crc32("Hello World"));
46
50
// printf("%" PRIu32 "\n", crc32("Hello World!"));
47
51
// printf("%" PRIu32 "\n", crc32("Hello world"));
Original file line number Diff line number Diff line change @@ -32,10 +32,14 @@ uint64_t djb2(const char* s)
32
32
*/
33
33
void test_djb2 ()
34
34
{
35
- assert (djb2 ("Hello World" ) == (const uint64_t )13827776004929097857 );
36
- assert (djb2 ("Hello World!" ) == (const uint64_t )13594750393630990530 );
37
- assert (djb2 ("Hello world" ) == (const uint64_t )13827776004967047329 );
38
- assert (djb2 ("Hello world!" ) == (const uint64_t )13594750394883323106 );
35
+ const uint64_t test1 = 13827776004929097857 ;
36
+ assert (djb2 ("Hello World" ) == test1 );
37
+ const uint64_t test2 = 13594750393630990530 ;
38
+ assert (djb2 ("Hello World!" ) == test2 );
39
+ const uint64_t test3 = 13827776004967047329 ;
40
+ assert (djb2 ("Hello world" ) == test3 );
41
+ const uint64_t test4 = 13594750394883323106 ;
42
+ assert (djb2 ("Hello world!" ) == test4 );
39
43
printf ("Tests passed\n" );
40
44
}
41
45
Original file line number Diff line number Diff line change @@ -32,10 +32,14 @@ uint64_t sdbm(const char* s)
32
32
*/
33
33
void test_sdbm ()
34
34
{
35
- assert (sdbm ("Hello World" ) == (const uint64_t )12881824461405877380 );
36
- assert (sdbm ("Hello World!" ) == (const uint64_t )7903571203300273309 );
37
- assert (sdbm ("Hello world" ) == (const uint64_t )15154913742888948900 );
38
- assert (sdbm ("Hello world!" ) == (const uint64_t )15254999417003201661 );
35
+ const uint64_t test1 = 12881824461405877380 ;
36
+ assert (sdbm ("Hello World" ) == test1 );
37
+ const uint64_t test2 = 7903571203300273309 ;
38
+ assert (sdbm ("Hello World!" ) == test2 );
39
+ const uint64_t test3 = 15154913742888948900 ;
40
+ assert (sdbm ("Hello world" ) == test3 );
41
+ const uint64_t test4 = 15254999417003201661 ;
42
+ assert (sdbm ("Hello world!" ) == test4 );
39
43
printf ("Tests passed\n" );
40
44
}
41
45
You can’t perform that action at this time.
0 commit comments