diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-05 13:38:04 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-05 13:38:04 +0100 |
| commit | b9aacd9c2fdc61721c8ca3e1b40ebc92daa3772e (patch) | |
| tree | bec510bca7b72b8fe63b7f8cec1fd78b7ff03bc2 /lib/core/tests/iterator.cpp | |
| parent | f5c40005f576b5a3416c2cda8c60e5f100810ddb (diff) | |
| download | libs-lbm-b9aacd9c2fdc61721c8ca3e1b40ebc92daa3772e.tar.gz | |
Reworking structure
Diffstat (limited to 'lib/core/tests/iterator.cpp')
| -rw-r--r-- | lib/core/tests/iterator.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/core/tests/iterator.cpp b/lib/core/tests/iterator.cpp new file mode 100644 index 0000000..261765a --- /dev/null +++ b/lib/core/tests/iterator.cpp @@ -0,0 +1,55 @@ +#include <forstio/test/suite.hpp> + +#include "../c++/iterator.hpp" + +#include <iostream> + +namespace { +namespace sch { +using namespace kel::lbm::sch; +} + +SAW_TEST("Old Iterate"){ + using namespace kel; + + saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}}; + saw::data<sch::FixedArray<sch::UInt64,2u>> end{{3u,3u}}; + + lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ + std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; + }, start, end); +} + +SAW_TEST("Old Iterate with Distance 1"){ + using namespace kel; + + saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}}; + saw::data<sch::FixedArray<sch::UInt64,2u>> end{{4u,4u}}; + + lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ + std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; + }, start, end, {{1u,1u}}); +} + +SAW_TEST("Iterate - 2D"){ + using namespace kel; + + saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}}; + saw::data<sch::FixedArray<sch::UInt64,2u>> end{{3u,3u}}; + + lbm::iterator<2u>::apply([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ + std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; + }, start, end); +} + +SAW_TEST("Iterate with Distance 1 - 2D"){ + using namespace kel; + + saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}}; + saw::data<sch::FixedArray<sch::UInt64,2u>> end{{4u,4u}}; + + lbm::iterator<2u>::apply([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ + std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; + }, start, end, {{1u,1u}}); +} +} |
