-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgraph_test_utils.hpp
49 lines (39 loc) · 1.46 KB
/
graph_test_utils.hpp
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
/*
* Copyright (C) 2011 Leo Osvald <leo.osvald@gmail.com>
*
* This file is part of KSP Library.
*
* KSP Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* KSP Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRAPH_TEST_UTILS_HPP_
#define GRAPH_TEST_UTILS_HPP_
#include <string>
#include <sstream>
#include "../src/graph_builder.hpp"
namespace ksp {
namespace test {
template<typename V, typename T, class VCompare>
Edge<T> E(const GraphBuilder<V, T, VCompare>& g,
V tail, V head, T edge_data) {
return Edge<T>(g.vertex_id(tail), g.vertex_id(head), edge_data);
}
template<typename V, typename T, class VCompare>
std::string EStr(const GraphBuilder<V, T, VCompare>& g, const Edge<T>& e) {
std::ostringstream oss;
oss << g.vertex(e.tail) << " -> " << g.vertex(e.head) << ": " << e.data;
return "(" + oss.str() + ")";
}
} // namespace test
} // namespace ksp
#endif /* GRAPH_TEST_UTILS_HPP_ */