From 205f2459063a123cabd83fb66b3880a72fb357bf Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 23 Jun 2017 21:19:11 +0100 Subject: Continuing tests --- test/matrixtest.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/matrixtest.cpp b/test/matrixtest.cpp index fd9a0bb7..ce4e9187 100644 --- a/test/matrixtest.cpp +++ b/test/matrixtest.cpp @@ -14,6 +14,10 @@ void test(TestBench &tb, const std::string &test_name, bool result) { tb.startTest(test_name); tb.endTest(result); + if(!result) + { + throw std::runtime_error(test_name+" failed..."); + } } bool matrixAssign() @@ -21,27 +25,73 @@ bool matrixAssign() yage::Matrix<4, 5, int> m; m[2][3]=5; - return m[2][3]==5; + return m[2][3]==4; } bool matrixAddition() { yage::Matrix<4, 4, int> m1, m2; - m1[1][1] = 293; - m2[1][1] = 583; + m1[1][1]=293; + m2[1][1]=583; - yage::Matrix<4, 4, int> m3 = m1 + m2; + yage::Matrix<4, 4, int> m3=m1+m2; - return m3[1][1] == 876; + return m3[1][1]==876; +} + +bool vectorDotProduct() +{ + yage::Vector<3, int> v1, v2; + v1[0] = 2; + v1[1] = 3; + v1[2] = 5; + v2[0] = 9; + v2[1] = 6; + v2[2] = 8; + + int x = yage::matrix::dot(v1, v2); + + return x==76; +} + +bool matrixMultiplication() +{ + } int main() { TestBench tb; - test(tb, "Matrix Assign", matrixAssign()); - test(tb, "Matrix Addition", matrixAddition()); + bool all_passed=true; + + try + { + test(tb, "Matrix Assign", matrixAssign()); + } + catch(std::exception e) + { + std::cout<