Ticket #7008: tests.h

File tests.h, 930 bytes (added by TriEdgeAI, 7 years ago)

The file I used to test the correctness of the implemented and the fixed functions.

Line 
1void
2test_div()
3{
4 div_t result;
5
6 printf("test_div()\n");
7 printf("------------------\n");
8
9 result = div(5, 2);
10 printf("%i %i\n", result.quot, result.rem);
11
12 result = div(-5, 2);
13 printf("%i %i\n", result.quot, result.rem);
14
15 result = div(-5, -2);
16 printf("%i %i\n", result.quot, result.rem);
17
18 result = div(5, -2);
19 printf("%i %i\n", result.quot, result.rem);
20
21 printf("------------------\n");
22 printf("\n");
23}
24
25void
26test_l64a()
27{
28 printf("test_l64a()\n");
29 printf("------------------\n");
30
31 printf("%s\n", l64a(256*256*256));
32 printf("%s\n", l64a(0));
33 printf("%s\n", l64a(57));
34 printf("%s\n", l64a(342353332));
35
36 printf("------------------\n");
37 printf("\n");
38}
39
40void
41test_a64l()
42{
43 printf("test_a64l()\n");
44 printf("------------------\n");
45
46 printf("%i\n", a64l("..../"));
47 printf("%i\n", a64l(""));
48 printf("%i\n", a64l("t"));
49 printf("%i\n", a64l("oKyNI"));
50
51 printf("------------------\n");
52 printf("\n");
53}