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

Function test

code/graph/dijkstra.test.cpp:4–32  ·  view source on GitHub ↗

Field testing: USACO butter, UVa 721 */

Source from the content-addressed store, hash-verified

2
3/* Field testing: USACO butter, UVa 721 */
4void test() {
5 ifstream ifs("dijkstra.test.in");
6 int ts;
7 ifs >> ts;
8 for (int t = 0; t < ts; t++) {
9 int n, m;
10 ifs >> n >> m;
11 vector<ii> *adj = new vector<ii>[n];
12 for (int i = 0; i < m; i++) {
13 int a, b, c;
14 ifs >> a >> b >> c;
15 adj[a].push_back(ii(b, c));
16 }
17
18 for (int i = 0; i < n; i++) {
19 pair<int*, int*> res = dijkstra(n, i, adj);
20 for (int j = 0; j < n; j++) {
21 int correct;
22 ifs >> correct;
23
24 if (correct == -1) {
25 assert_equal(INF, res.first[j]);
26 } else {
27 assert_equal(correct, res.first[j]);
28 }
29 }
30 }
31 }
32}
33// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 3

dijkstraFunction · 0.85
push_backMethod · 0.80
assert_equalFunction · 0.50

Tested by

no test coverage detected