8 #ifndef GRAPH_UNIT_TEST_HPP_
9 #define GRAPH_UNIT_TEST_HPP_
12 #include "map_graph.hpp"
13 #include "Point_test.hpp"
15 #ifdef TEST_COVERAGE_MODE
21 BOOST_AUTO_TEST_SUITE( graph_test )
23 BOOST_AUTO_TEST_CASE( graph_use)
25 std::cout <<
"Graph unit test start" <<
"\n";
39 p.get<V::v>()[0] = 1.0;
40 p.get<V::v>()[1] = 2.0;
41 p.get<V::v>()[2] = 7.0;
43 p.get<V::t>()[0][0] = 10.0;
44 p.get<V::t>()[0][1] = 13.0;
45 p.get<V::t>()[0][2] = 8.0;
46 p.get<V::t>()[1][0] = 19.0;
47 p.get<V::t>()[1][1] = 23.0;
48 p.get<V::t>()[1][2] = 5.0;
49 p.get<V::t>()[2][0] = 4.0;
50 p.get<V::t>()[2][1] = 3.0;
51 p.get<V::t>()[2][2] = 11.0;
62 for (
size_t i = 0 ; i < GS_SIZE ; i++)
64 for (
size_t j = 0 ; j < GS_SIZE ; j++)
78 std::vector<size_t> gs;
79 gs.push_back(GS_SIZE);
80 gs.push_back(GS_SIZE);
86 for (
size_t i = 0 ; i < GS_SIZE ; i++)
88 for (
size_t j = 0 ; j < GS_SIZE ; j++)
107 for (
size_t i = 0 ; i < g.getNVertex() ; i++)
109 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::x>(),g_dup.
vertex(i).template get<V::x>());
110 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::y>(),g_dup.
vertex(i).template get<V::y>());
111 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::z>(),g_dup.
vertex(i).template get<V::z>());
112 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::s>(),g_dup.
vertex(i).template get<V::s>());
114 for (
int j = 0 ; j < 3 ; j++)
116 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::v>()[j],g_dup.
vertex(i).template get<V::v>()[j]);
119 for (
int j = 0 ; j < 3 ; j++)
121 for (
int k = 0 ; k < 3 ; k++)
123 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::t>()[j][k],g_dup.
vertex(i).template get<V::t>()[j][k]);
179 for (
size_t i = 0 ; i < g_no_edge.
getNVertex() ; i++)
184 size_t s1 = g_no_edge.
getChild(i,0);
185 size_t s2 = g_no_edge.
getChild(i,1);
187 BOOST_REQUIRE_EQUAL(s1+1,s2);
189 size_t a = log2(i + 1);
190 size_t start = (a == 0)?1:(2 << (a-1));
192 size_t start_p = 2 << a;
195 BOOST_REQUIRE_EQUAL(s1,start_p + (i - start)*2);
198 std::cout <<
"Graph unit test end" <<
"\n";
201 BOOST_AUTO_TEST_SUITE_END()
auto vertex(size_t id) -> decltype(v.get(id))
Function to access the vertexes.
auto addEdge(size_t v1, size_t v2, const E &ed) -> decltype(e.get(0))
add edge on the graph
void addVertex(const V &vrt)
add vertex
Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p > duplicate()
It duplicate the graph.
size_t getNChilds(size_t c) const
Return the number of childs of a vertex.
class that store the information of the grid like number of point on each direction and define the in...
size_t getNVertex() const
Return the number of the vertex.
size_t getChild(size_t v, size_t i) const
Get the child edge.
Test structure used for several test.
Class to check if the edge can be created or not.