MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / test

Function test

code/graph/tsort.test.cpp:1–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1void test() {
2 vvi graph(2);
3 graph[0].push_back(1);
4 bool has_error;
5 vi res = tsort(2, graph, has_error);
6 assert_false(has_error);
7 assert_equal(0, res[0]);
8 assert_equal(1, res[1]);
9
10 vvi graph2(2);
11 graph2[0].push_back(1);
12 graph2[1].push_back(0);
13 res = tsort(2, graph2, has_error);
14 assert_true(has_error);
15
16 vvi graph3(3);
17 graph3[0].push_back(2);
18 graph3[1].push_back(0);
19 graph3[1].push_back(2);
20 res = tsort(3, graph3, has_error);
21 assert_false(has_error);
22 assert_equal(1, res[0]);
23 assert_equal(0, res[1]);
24 assert_equal(2, res[2]);
25}
26// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 5

tsortFunction · 0.85
assert_falseFunction · 0.85
assert_trueFunction · 0.85
push_backMethod · 0.80
assert_equalFunction · 0.50

Tested by

no test coverage detected