8#ifndef GRAPH_UNIT_TEST_HPP_
9#define GRAPH_UNIT_TEST_HPP_
12#include "map_graph.hpp"
13#include "Point_test.hpp"
15BOOST_AUTO_TEST_SUITE( graph_test )
17BOOST_AUTO_TEST_CASE( graph_use)
19 std::cout <<
"Graph unit test start" <<
"\n";
33 p.
get<V::v>()[0] = 1.0;
34 p.
get<V::v>()[1] = 2.0;
35 p.
get<V::v>()[2] = 7.0;
37 p.
get<V::t>()[0][0] = 10.0;
38 p.
get<V::t>()[0][1] = 13.0;
39 p.
get<V::t>()[0][2] = 8.0;
40 p.
get<V::t>()[1][0] = 19.0;
41 p.
get<V::t>()[1][1] = 23.0;
42 p.
get<V::t>()[1][2] = 5.0;
43 p.
get<V::t>()[2][0] = 4.0;
44 p.
get<V::t>()[2][1] = 3.0;
45 p.
get<V::t>()[2][2] = 11.0;
56 for (
size_t i = 0 ; i < GS_SIZE ; i++)
58 for (
size_t j = 0 ; j < GS_SIZE ; j++)
76 size_t gs[2] = {GS_SIZE,GS_SIZE};
82 for (
size_t i = 0 ; i < GS_SIZE ; i++)
84 for (
size_t j = 0 ; j < GS_SIZE ; j++)
103 for (
size_t i = 0 ; i < g.getNVertex() ; i++)
105 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::x>(),g_dup.
vertex(i).template get<V::x>());
106 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::y>(),g_dup.
vertex(i).template get<V::y>());
107 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::z>(),g_dup.
vertex(i).template get<V::z>());
108 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::s>(),g_dup.
vertex(i).template get<V::s>());
110 for (
int j = 0 ; j < 3 ; j++)
112 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::v>()[j],g_dup.
vertex(i).template get<V::v>()[j]);
115 for (
int j = 0 ; j < 3 ; j++)
117 for (
int k = 0 ; k < 3 ; k++)
119 BOOST_REQUIRE_EQUAL(g.vertex(i).template get<V::t>()[j][k],g_dup.
vertex(i).template get<V::t>()[j][k]);
175 for (
size_t i = 0 ; i < g_no_edge.
getNVertex() ; i++)
180 size_t s1 = g_no_edge.
getChild(i,0);
181 size_t s2 = g_no_edge.
getChild(i,1);
183 BOOST_REQUIRE_EQUAL(s1+1,s2);
185 size_t a = log2(i + 1);
186 size_t start = (a == 0)?1:(2 << (a-1));
188 size_t start_p = 2 << a;
191 BOOST_REQUIRE_EQUAL(s1,start_p + (i - start)*2);
194 std::cout <<
"Graph unit test end" <<
"\n";
197BOOST_AUTO_TEST_SUITE_END()
Class to check if the edge can be created or not.
Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
auto vertex(size_t id) -> decltype(v.get(id))
Function to access the vertex.
void addVertex(const V &vrt)
add vertex
size_t getChild(size_t v, size_t i) const
Get the child vertex id.
size_t getNChilds(size_t c) const
Return the number of childs of a vertex.
size_t getNVertex() const
Return the number of the vertex.
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p > duplicate() const
It duplicate the graph.
auto addEdge(size_t v1, size_t v2, const E &ed) -> decltype(e.get(0))
add edge on the graph
Test structure used for several test.
void sety(T y_)
set the y property
void setz(T z_)
set the z property
auto get() -> decltype(boost::fusion::at_c< i >(data))
getter method for a general property i
void sets(T s_)
set the s property
void setx(T x_)
set the x property