OpenFPM_io  0.2.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Functions Variables Typedefs
CSVWriter_unit_tests.hpp
1 #ifndef CSVWRITER_UNIT_TESTS_HPP_
2 #define CSVWRITER_UNIT_TESTS_HPP_
3 
4 #include "CSVWriter.hpp"
5 #include "Vector/vector_test_util.hpp"
6 
7 BOOST_AUTO_TEST_SUITE( csv_writer_test )
8 
9 
10 BOOST_AUTO_TEST_CASE( csv_writer_particles )
11 {
12  // Allocate a property vector
13  auto v_prp = allocate_openfpm_prp(16);
14  // Vector of position
15  openfpm::vector<Point<3,float>> v_pos;
16 
17  // create a positional vector
18  for (size_t i = 0 ; i < v_prp.size() ; i++)
19  {
20  Point<3,float> p({1.0,2.0,3.0});
21 
22  v_pos.add(p);
23  }
24 
25  // CSVWriter test
26  CSVWriter<openfpm::vector<Point<3,float>>, openfpm::vector<Point_test_prp<float>> > csv_writer;
27 
28  // Write the CSV
29  csv_writer.write("csv_out.csv",v_pos,v_prp);
30 
31  bool test = compare("csv_out.csv","csv_out_test.csv");
32  BOOST_REQUIRE_EQUAL(true,test);
33 
34 
35 }
36 
37 BOOST_AUTO_TEST_SUITE_END()
38 
39 #endif
CSV Writer.
Definition: CSVWriter.hpp:149
bool write(std::string file, v_pos &v, v_prp &prp, size_t offset=0)
It write a CSV file.
Definition: CSVWriter.hpp:235