aboutsummaryrefslogtreecommitdiffstats
path: root/test/matrixtest.cpp
blob: fd9a0bb72dae5a806ff2aced32d088ed93e30f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * created 22-06-17 by Yann Herklotz
 *
 * Tests the math class using different tests to see if matrix operations work 
 * correctly.
 *
 */

#include "Math/math.hpp"

#include "testbench.hpp"

void test(TestBench &tb, const std::string &test_name, bool result)
{
	tb.startTest(test_name);
	tb.endTest(result);
}

bool matrixAssign()
{
	yage::Matrix<4, 5, int> m;
	m[2][3]=5;

	return m[2][3]==5;
}

bool matrixAddition()
{
	yage::Matrix<4, 4, int> m1, m2;
	m1[1][1] = 293;
	m2[1][1] = 583;

	yage::Matrix<4, 4, int> m3 = m1 + m2;

	return m3[1][1] == 876;
}

int main()
{
	TestBench tb;

	test(tb, "Matrix Assign", matrixAssign());
	test(tb, "Matrix Addition", matrixAddition());
	
	tb.printResults();
	return 0;
}