OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
Mem_type_unit_tests.cpp
1/*
2 * Mem_type_unit_tests.cpp
3 *
4 * Created on: Dec 26, 2017
5 * Author: Pietro Incardona
6 */
7
8#define BOOST_TEST_DYN_LINK
9#include <boost/test/unit_test.hpp>
10#include "NN/Mem_type/MemFast.hpp"
11#include "NN/Mem_type/MemBalanced.hpp"
12#include "NN/Mem_type/MemMemoryWise.hpp"
13
14BOOST_AUTO_TEST_SUITE( Mem_type_test )
15
16template<typename Mem_type>
17void test_mem_type()
18{
19 Mem_type mem(128);
20
21 //
22
23 mem.init_to_zero(128,10);
24
25 mem.add(0,5);
26
27 BOOST_REQUIRE_EQUAL(mem.getNelements(0),1ul);
28
29 BOOST_REQUIRE_EQUAL(mem.get(0,0),5ul);
30
31 mem.init_to_zero(128,5);
32
33 BOOST_REQUIRE_EQUAL(mem.getNelements(0),0ul);
34}
35
36BOOST_AUTO_TEST_CASE ( Mem_type_check )
37{
38 test_mem_type<Mem_fast<>>();
39 test_mem_type<Mem_bal<>>();
40 test_mem_type<Mem_mw<>>();
41}
42
43BOOST_AUTO_TEST_SUITE_END()