summaryrefslogtreecommitdiff
path: root/modules/codec/tests/math.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/codec/tests/math.cpp')
-rw-r--r--modules/codec/tests/math.cpp18
1 files changed, 18 insertions, 0 deletions
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()));
+ }
}
}