MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / test

Function test

code/geometry/primitives3d.test.cpp:14–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14void test() {
15 point3d p;
16 assert_equal(p, point3d(0,0,0));
17
18 assert_equal(point3d(7,8,0) - point3d(2,4,-10), point3d(5, 4, 10));
19 assert_equal(point3d(-2.0, -3.789, 17.0*pi/200.0) + point3d(344889.9, 0, exp(1.0)), point3d(344887.9, -3.789, 17.0*pi/200.0 + exp(1.0)));
20 assert_equal(-point3d(-1.0, -2.0, 3.0), point3d(1.0, 2.0, -3.0));
21 assert_equal(point3d(1.0, 2.0, 3.0)*2.0, point3d(2.0, 4.0, 6.0));
22 assert_equal(point3d(1.0, pi, exp(1.0))*(log(100000)), point3d((log(100000)), pi*(log(100000)), exp(1.0)*(log(100000))));
23 assert_equal(point3d(-1.0, -2.0, 3.0)/exp(2.0), point3d(-1.0/exp(2.0), -2.0/exp(2.0), 3.0/exp(2.0)));
24
25 assert_equal(point3d(1, 2, 3)%point3d(2,3,4), 20.0);
26 assert_equal(point3d(2, 7, -9) * point3d(4, -2, 8), point3d(38, -52, -32));
27 assert_equal(point3d(0, 7.8023, -9) * point3d(4, -2.089, 8.098), point3d(44.3820254, -36.0, -31.2092));
28
29 assert_equal(point3d(0,0,0).distTo(point3d(4, -7, 9)), point3d(4, -7, 9).length());
30 assert_nearly_equal(point3d(0.09,3,2).distTo(point3d(4, -7, 9)), 12.817491954);
31
32 assert_nearly_equal(point3d(exp(2.7), pi*2, -log(1000000.0)).normalize().length(), 1.0);
33 assert_nearly_equal(point3d(exp(2.7), pi*2, -log(1000000.0)).normalize(7.93).length(), 7.93);
34}
35// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 6

point3dClass · 0.85
distToMethod · 0.80
lengthMethod · 0.80
normalizeMethod · 0.80
assert_equalFunction · 0.70
assert_nearly_equalFunction · 0.70

Tested by

no test coverage detected