summaryrefslogtreecommitdiff
path: root/modules/codec/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/codec/tests')
-rw-r--r--modules/codec/tests/math.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/codec/tests/math.cpp b/modules/codec/tests/math.cpp
index ad2d9a6..4fb012f 100644
--- a/modules/codec/tests/math.cpp
+++ b/modules/codec/tests/math.cpp
@@ -1,6 +1,7 @@
#include <forstio/test/suite.hpp>
#include "../c++/data.hpp"
#include "../c++/data_math.hpp"
+#include "../c++/math.hpp"
#include "../c++/csv.hpp"
#include <iostream>
@@ -55,4 +56,23 @@ SAW_TEST("Math/Tensor"){
SAW_EXPECT(d.at({{1u,1u}}).get() == 1.0, std::string{"Unexpected value at (1,1): "} + std::to_string(d.at({{1u,1u}}).get()));
}
}
+
+SAW_TEST("Math/Dot"){
+ using namespace saw;
+
+ data<sch::Vector<sch::Float64, 2u>> a;
+ {
+ a.at({{0u}}) = 2.0;
+ a.at({{1u}}) = 1.0;
+ }
+ data<sch::Vector<sch::Float64, 2u>> b;
+ {
+ b.at({{0u}}) = -1.0;
+ b.at({{1u}}) = 5.0;
+ }
+
+ auto c = math::dot(a,b);
+
+ SAW_EXPECT(c.at({}).get() == 3.0, std::string{"Unexpected value for dot product "} + std::to_string(c.at({}).get()) );
+}
}