-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunittests.cpp
36 lines (27 loc) · 862 Bytes
/
unittests.cpp
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
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_COLOUR_NONE
#include "catch.hpp"
/*// IMPORTANT NOTE:
// These are just a few examples from my solution and **should be removed**.
// Depending on your code design your class and functions names would differ
#include "geometry.hpp"
TEST_CASE( "Test Basic Geometry: Vec3d ", "[geometry]" ) {
Vec3d a(2,0,0), b(0,4,0);
REQUIRE(a.x == Approx(2));
REQUIRE(a.y == Approx(0));
REQUIRE(a.z == Approx(0));
REQUIRE(b.x == Approx(0));
REQUIRE(b.y == Approx(4));
REQUIRE(b.z == Approx(0));
double adotb = dot(a,b);
REQUIRE(adotb == Approx(0));
Vec3d anorm = norm(a);
REQUIRE(anorm.x == Approx(1));
REQUIRE(anorm.y == Approx(0));
REQUIRE(anorm.z == Approx(0));
Vec3d bnorm = norm(b);
REQUIRE(bnorm.x == Approx(0));
REQUIRE(bnorm.y == Approx(1));
REQUIRE(bnorm.z == Approx(0));
}
*/