Field testing: USACO butter, UVa 721 */
| 2 | |
| 3 | /* Field testing: USACO butter, UVa 721 */ |
| 4 | void 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: |
nothing calls this directly
no test coverage detected