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 | |
13 | BOOST_AUTO_TEST_SUITE( raw_reader_unit_test ) |
14 | |
15 | |
16 | BOOST_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 | grid_cpu<3,aggregate<float,float[3]>> read_bin_test; |
24 | |
25 | GridRawReader<3,aggregate<float,float[3]>,int> rr; |
26 | |
27 | #ifndef SE_CLASS3 |
28 | |
29 | rr.read("test_data/raw_read_sv_test.bin" ,read_bin_test,FORTRAN_STYLE | STRUCT_OF_ARRAY,12); |
30 | |
31 | auto it = read_bin_test.getIterator(); |
32 | |
33 | while (it.isNext()) |
34 | { |
35 | auto key = it.get(); |
36 | |
37 | BOOST_REQUIRE_EQUAL(read_bin_test.template get<0>(key),1.5f); |
38 | |
39 | BOOST_REQUIRE_EQUAL(read_bin_test.template get<1>(key)[0],1.5f); |
40 | BOOST_REQUIRE_EQUAL(read_bin_test.template get<1>(key)[1],2.5f); |
41 | BOOST_REQUIRE_EQUAL(read_bin_test.template get<1>(key)[2],3.5f); |
42 | |
43 | ++it; |
44 | } |
45 | |
46 | #endif |
47 | } |
48 | |
49 | |
50 | |
51 | BOOST_AUTO_TEST_SUITE_END() |
52 | |
53 | #endif /* OPENFPM_DATA_SRC_PLOT_PLOT_UNIT_TESTS_HPP_ */ |
54 | |