diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-05 15:59:23 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-05 15:59:23 +0200 |
| commit | c0549d71b2109f10c1238db8b22362e7826ba61b (patch) | |
| tree | 16cd5264fcc3afe912e1b1b67738c8940d6d1177 /modules/core/tests/chunk.cpp | |
| parent | 9a3147bc79caf3c0fb1a9cdee29d156b5ff092c7 (diff) | |
| download | libs-lbm-c0549d71b2109f10c1238db8b22362e7826ba61b.tar.gz | |
Just rename from lib to modules
Diffstat (limited to 'modules/core/tests/chunk.cpp')
| -rw-r--r-- | modules/core/tests/chunk.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/modules/core/tests/chunk.cpp b/modules/core/tests/chunk.cpp new file mode 100644 index 0000000..008d4c6 --- /dev/null +++ b/modules/core/tests/chunk.cpp @@ -0,0 +1,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 2D 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."); +} + +} |
