8 #ifndef GRAPHMLWRITER_UNIT_TESTS_HPP_
9 #define GRAPHMLWRITER_UNIT_TESTS_HPP_
13 #include "GraphMLWriter.hpp"
14 #include "Graph/CartesianGraphFactory.hpp"
17 BOOST_AUTO_TEST_SUITE( graphml_writer_test )
28 typedef boost::fusion::vector<float,float,float,double,long int,int,std::string>
type;
30 typedef typename memory_traits_inte<type>::type memory_int;
31 typedef typename memory_traits_lin<type>::type memory_lin;
37 static const unsigned int x = 0;
39 static const unsigned int y = 1;
41 static const unsigned int z = 2;
43 static const unsigned int double_num = 3;
45 static const unsigned int long_num = 4;
47 static const unsigned int integer = 5;
49 static const unsigned int string = 6;
51 static const unsigned int max_prop = 7;
54 float &
get_x() {
return boost::fusion::at_c<x>(data);}
56 float &
get_y() {
return boost::fusion::at_c<y>(data);}
58 float &
get_z() {
return boost::fusion::at_c<z>(data);}
60 double &
get_dn() {
return boost::fusion::at_c<double_num>(data);}
62 long int &
get_ln() {
return boost::fusion::at_c<long_num>(data);}
64 int &
get_i() {
return boost::fusion::at_c<integer>(data);}
66 std::string &
get_str() {
return boost::fusion::at_c<string>(data);}
71 static const std::string name[max_prop];
79 const std::string ne_cp::attributes::name[] = {
"x",
"y",
"z",
"double_num",
"long_num",
"integer",
"string"};
81 BOOST_AUTO_TEST_CASE( graphml_writer_use)
83 Graph_CSR<ne_cp,ne_cp> g_csr2;
94 n1.get_str() = std::string(
"test");
96 n1.get_str() = std::string(
"tes2");
98 n1.get_str() = std::string(
"test3");
100 n1.get_str() = std::string(
"test4");
101 g_csr2.addVertex(n1);
102 n1.get_str() = std::string(
"test5");
104 g_csr2.addEdge(0,1,n1);
105 n1.get_str() = std::string(
"test6");
106 g_csr2.addEdge(2,1,n1);
107 n1.get_str() = std::string(
"test7");
108 g_csr2.addEdge(3,1,n1);
109 n1.get_str() = std::string(
"test8");
110 g_csr2.addEdge(2,0,n1);
111 n1.get_str() = std::string(
"test9");
112 g_csr2.addEdge(3,2,n1);
116 gv2.write(
"test_graph2.graphml");
120 bool test = compare(
"test_graph2.graphml",
"test_graph2_test.graphml");
121 BOOST_REQUIRE_EQUAL(
true,test);
125 CartesianGraphFactory<3,Graph_CSR<ne_cp,ne_cp>> g_factory;
128 size_t sz[] = {GS_SIZE,GS_SIZE,GS_SIZE};
131 Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
134 size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
140 gw.write(
"test_graph.graphml");
144 test = compare(
"test_graph.graphml",
"test_graph_test.graphml");
145 BOOST_REQUIRE_EQUAL(
true,test);
148 BOOST_AUTO_TEST_SUITE_END()
float s_type
type of the spatial information
std::string & get_str()
get string
double & get_dn()
get double number
boost::fusion::vector< float, float, float, double, long int, int, std::string > type
The node contain several properties.
long int & get_ln()
get long number
static const unsigned int z
z property id in boost::fusion::vector
static const unsigned int x
x property id in boost::fusion::vector
static const unsigned int y
y property id in boost::fusion::vector