summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2025-08-07 13:14:16 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2025-08-07 13:14:16 +0200
commit45ca44d5f0387a0551cef87168a59d6df97f66fe (patch)
treeafa183926f44f7cfc8826d5877ce9b1de91c5393
parent8066ec42f2a358b377806e1b093efcdbe9dac6fd (diff)
Fixed iterator issue when testing addition
-rw-r--r--modules/codec/c++/data.hpp3
-rw-r--r--modules/codec/tests/math.cpp18
2 files changed, 19 insertions, 2 deletions
diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp
index 48b2e60..013b475 100644
--- a/modules/codec/c++/data.hpp
+++ b/modules/codec/c++/data.hpp
@@ -318,8 +318,7 @@ private:
public:
constexpr data() = default;
- constexpr data(data<MetaSchema, encode::Native>){
- }
+ constexpr data(data<MetaSchema, encode::Native>){}
constexpr data(const std::array<data<T, encode::Native>, ct_multiply<uint64_t,D...>::value>& value__):
value_{value__}
diff --git a/modules/codec/tests/math.cpp b/modules/codec/tests/math.cpp
index 4240df5..8b3b6f9 100644
--- a/modules/codec/tests/math.cpp
+++ b/modules/codec/tests/math.cpp
@@ -24,9 +24,27 @@ SAW_TEST("Math/Tensor"){
using namespace saw;
data<sch::Matrix<sch::Float64,2u,2u> > a;
+ {
+ a.at({{0u,0u}}) = 1.0;
+ a.at({{0u,1u}}) = 2.0;
+ a.at({{1u,0u}}) = 3.0;
+ a.at({{1u,1u}}) = 4.0;
+ }
data<sch::Matrix<sch::Float64,2u,2u> > b;
+ {
+ b.at({{0u,0u}}) = 2.0;
+ b.at({{0u,1u}}) = 3.0;
+ b.at({{1u,0u}}) = 4.0;
+ b.at({{1u,1u}}) = 5.0;
+ }
auto c = a + b;
+ {
+ SAW_EXPECT(c.at({{0u,0u}}).get() == 3.0, std::string{"Unexpected value at (0,0): "} + std::to_string(c.at({{0u,0u}}).get()) );
+ SAW_EXPECT(c.at({{0u,1u}}).get() == 5.0, std::string{"Unexpected value at (0,1): "} + std::to_string(c.at({{0u,1u}}).get()));
+ SAW_EXPECT(c.at({{1u,0u}}).get() == 7.0, std::string{"Unexpected value at (1,0): "} + std::to_string(c.at({{1u,0u}}).get()));
+ SAW_EXPECT(c.at({{1u,1u}}).get() == 9.0, std::string{"Unexpected value at (1,1): "} + std::to_string(c.at({{1u,1u}}).get()));
+ }
}
}