]> git.localhorst.tv Git - blobs.git/blob - tst/assert.hpp
more orbits and stuff
[blobs.git] / tst / assert.hpp
1 #ifndef BLOBS_TEST_ASSETS_HPP_
2 #define BLOBS_TEST_ASSETS_HPP_
3
4 #include "graphics/glm.hpp"
5
6 #include <string>
7 #include <limits>
8
9
10 namespace blobs {
11 namespace test {
12
13 template<class T>
14 void AssertEqual(
15         const std::string &msg,
16         const glm::tvec3<T> &expected,
17         const glm::tvec3<T> &actual,
18         T epsilon = std::numeric_limits<T>::epsilon()
19 ) {
20         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
21                 msg + " (X component)",
22                 expected.x, actual.x, epsilon
23         );
24         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
25                 msg + " (Y component)",
26                 expected.y, actual.y, epsilon
27         );
28         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
29                 msg + " (Z component)",
30                 expected.z, actual.z, epsilon
31         );
32 }
33
34 }
35 }
36
37 #endif