summaryrefslogtreecommitdiff
path: root/lib/core/tests
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-03-20 18:33:31 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-03-20 18:33:31 +0100
commit14320632fbf39237b5f2254ec1d312ce3c12d879 (patch)
treed6ad720ba3f5912816e960f4fa146aafaeafe26a /lib/core/tests
parent2a5261cd719547686f283b2aeae004b589b69e32 (diff)
downloadlibs-lbm-14320632fbf39237b5f2254ec1d312ce3c12d879.tar.gz
Wanted to finish n linearity today, but I guess I should be happy with
this
Diffstat (limited to 'lib/core/tests')
-rw-r--r--lib/core/tests/math.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/core/tests/math.cpp b/lib/core/tests/math.cpp
index 970004b..d456ce8 100644
--- a/lib/core/tests/math.cpp
+++ b/lib/core/tests/math.cpp
@@ -20,7 +20,7 @@ SAW_TEST("Math 1-Linear"){
pos.at({{0u}}).set(0.3);
}
-SAW_TEST("Math/Floor Index from Pos"){
+SAW_TEST("Math/Floor Index and Fraction from Position"){
using namespace kel;
saw::data<sch::Vector<sch::Float64,2u>> pos;
@@ -45,4 +45,35 @@ SAW_TEST("Math/Floor Index from Pos"){
SAW_EXPECT(true, "Default true check");
}
+SAW_TEST("Math/Floor Index and Fraction from Position and Bounded"){
+ using namespace kel;
+
+ saw::data<sch::Vector<sch::Float64,2u>> pos;
+
+ {
+ pos.at({{0u}}) = 43.999;
+ pos.at({{1u}}) = -50.0;
+ }
+
+ saw::data<sch::Vector<sch::UInt64,2U>> bound;
+ {
+ bound.at({{0u}}) = 32u;
+ bound.at({{1u}}) = 16u;
+ }
+
+ auto ind_frac = lbm::position_to_index_and_fraction_bounded(pos,bound);
+ auto& ind = ind_frac.template get<0u>();
+ for(uint64_t i = 0u; i < 2u; ++i){
+ std::cout<<ind.at({{i}}).get()<<" ";
+ }
+ std::cout<<std::endl;
+ auto& frac = ind_frac.template get<1u>();
+ for(uint64_t i = 0u; i < 2u; ++i){
+ std::cout<<frac.at({{i}}).get()<<" ";
+ }
+ std::cout<<std::endl;
+
+ SAW_EXPECT(true, "Default true check");
+}
+
}