summaryrefslogtreecommitdiff
path: root/lib/core/tests/chunk.cpp
blob: a9d1748ae6a4f306139d1bda4e4d00ccd63c344d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <forstio/test/suite.hpp>

#include "../c++/chunk.hpp"

namespace {
namespace sch {
using namespace saw::schema;
}

SAW_TEST("Chunk Ghost size 0"){
	using namespace kel;

	using TestChunk = lbm::sch::Chunk<sch::UInt32, 0u, 2u, 3u, 4u>;
	using TestArray = sch::FixedArray<sch::UInt32, 2u, 3u, 4u>;

	SAW_EXPECT((std::is_same_v<TestChunk::InnerSchema,TestArray>), "Types are not identical");
}

SAW_TEST("Chunk Ghost size 1"){
	using namespace kel;

	using TestChunk = lbm::sch::Chunk<sch::UInt32,1u,2u,3u,4u>;
	using TestArray = sch::FixedArray<sch::UInt32,4u,5u,6u>;

	SAW_EXPECT((std::is_same_v<TestChunk::InnerSchema,TestArray>), "Types are not identical");
}

SAW_TEST("Chunk Ghost size 3"){
	using namespace kel;

	using TestChunk = lbm::sch::Chunk<sch::UInt32,3u,2u,3u,4u,10u,6u>;
	using TestArray = sch::FixedArray<sch::UInt32,8u,9u,10u,16u,12u>;

	SAW_EXPECT((std::is_same_v<TestChunk::InnerSchema,TestArray>), "Types are not identical");
}

SAW_TEST("Chunk setup"){
	using namespace kel;

	using TestChunk = lbm::sch::Chunk<sch::Float32, 1u, 2u, 2u>;

	auto chunk = saw::heap<saw::data<TestChunk>>();
	chunk->at({{0u,0u}}).set(1.0f);
	SAW_EXPECT((chunk->ghost_at({{1u,1u}}).get() == 1.0f),"Check if ghost is at shifted spot.");
}

}