OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
RawReader_unit_tests.hpp
1/*
2 * RawReader_unit_tests.hpp
3 *
4 * Created on: April 16, 2016
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_IO_RAW_READER_UNIT_TESTS_HPP_
9#define OPENFPM_IO_RAW_READER_UNIT_TESTS_HPP_
10
11#include "RawReader.hpp"
12
13BOOST_AUTO_TEST_SUITE( raw_reader_unit_test )
14
15
16BOOST_AUTO_TEST_CASE( raw_reader_read_test )
17{
18 Vcluster<> & v_cl = create_vcluster();
19
20 if (v_cl.getProcessUnitID() != 0)
21 return;
22
23#ifdef OPENFPM_PDATA
24
25 if (v_cl.rank() != 0) {return;}
26 std::string c2 = std::string("openfpm_io/test_data/raw_read_sv_test.bin");
27
28#else
29
30 std::string c2 = std::string("test_data/raw_read_sv_test.bin");
31
32#endif
33
35
37
38#ifndef SE_CLASS3
39
40 rr.read(c2,read_bin_test,FORTRAN_STYLE | STRUCT_OF_ARRAY,12);
41
42 auto it = read_bin_test.getIterator();
43
44 while (it.isNext())
45 {
46 auto key = it.get();
47
48 BOOST_REQUIRE_EQUAL(read_bin_test.template get<0>(key),1.5f);
49
50 BOOST_REQUIRE_EQUAL(read_bin_test.template get<1>(key)[0],1.5f);
51 BOOST_REQUIRE_EQUAL(read_bin_test.template get<1>(key)[1],2.5f);
52 BOOST_REQUIRE_EQUAL(read_bin_test.template get<1>(key)[2],3.5f);
53
54 ++it;
55 }
56
57#endif
58}
59
60
61
62BOOST_AUTO_TEST_SUITE_END()
63
64#endif /* OPENFPM_DATA_SRC_PLOT_PLOT_UNIT_TESTS_HPP_ */
bool read(std::string file, grid_cpu< dim, T > &gr, size_t opt=0, size_t skip=0)
Read a raw grid.
size_t rank()
Get the process unit id.
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Definition VCluster.hpp:59