-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
44 lines (40 loc) · 1.12 KB
/
Copy pathmain.c
File metadata and controls
44 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "main.h"
BOOLEAN
compare_arrs(const long *expect, const size_t length, const long *got, const size_t got_length){
size_t i = 0;
size_t minlen = MIN(length, got_length);
BOOLEAN failure = FALSE;
for(; i < minlen; i++){
if(expect[i] != got[i]){
printf("FAILURE, value %lu does not match (Got: (", i);
for(i=0; i < got_length; i++)
printf("%ld ", got[i]);
printf("), Expected: (");
for(i=0; i < length; i++)
printf("%ld ", expect[i]);
printf(")\n");
failure = TRUE;
}
}
if(length != got_length){
printf("FAILURE, inconsitent number of nodes (Got: %ld, Expected: %ld)\n", got_length, length);
failure = TRUE;
}
if(!failure) printf("PASS\n");
return !failure;
}
int
main(int argc, char** argv){
(void)argc;
(void)argv;
TEST("Singly Linked Lists", test_slist);
TEST("Doubly Linked Circular Lists", test_dlist);
TEST("Binary Trees", test_btree);
TEST("Splay Trees", test_splay);
TEST("Graphs", test_graph);
TEST("Scapegoat Trees", test_scapegoat);
TEST("Tree-like graphs", test_graph_tree);
TEST("Unrolled dlists (Array Lists)", test_udlist);
TEST("Hash Tables", test_htable);
return 0;
}