blob: 19d0eab6173598fa0b7c23f4980d2d099cb1a47a (
plain)
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
45
46
47
48
49
50
51
52
|
#include "config.h"
#include <stddef.h>
#include <assert.h>
#include <ccan/aga/aga.h>
#include <ccan/tap/tap.h>
#include "simple-graph.h"
#define NUM_ALGOS 2
#define check_one_inner(algo) \
ok1(aga_##algo##_start(&tg.sg.g) == -1);
#define check_all_inner() \
do { \
check_one_inner(dfs); \
check_one_inner(bfs); \
} while (0)
#define check_one_outer(algo) \
do { \
ok1(aga_##algo##_start(&tg.sg.g) == 0); \
check_all_inner(); \
aga_finish(&tg.sg.g); \
} while (0)
#define check_all_outer() \
do { \
check_one_outer(dfs); \
check_one_outer(bfs); \
} while (0)
int main(void)
{
struct trivial_graph tg;
if (NUM_ALGOS)
plan_tests(NUM_ALGOS + NUM_ALGOS * NUM_ALGOS);
else
plan_skip_all("Nothing to test");
trivial_graph_init(&tg);
check_all_outer();
/* This exits depending on whether all tests passed */
return exit_status();
}
|