MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / TEST

Function TEST

source/test/line_test.cpp:7–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace Star;
6
7TEST(LineTest, IntersectionEndpoint) {
8 Line2F a({0, 0}, {10, 10});
9 Line2F b({10, -10}, {0, 0});
10
11 auto intersection1 = a.intersection(b);
12 auto intersection2 = b.intersection(a);
13
14 EXPECT_TRUE(intersection1.intersects);
15 EXPECT_TRUE(intersection2.intersects);
16
17 EXPECT_TRUE(vmag(intersection1.point - Vec2F(0, 0)) < 0.0001f);
18 EXPECT_TRUE(vmag(intersection2.point - Vec2F(0, 0)) < 0.0001f);
19
20 EXPECT_TRUE(intersection1.glances);
21 EXPECT_TRUE(intersection2.glances);
22
23 EXPECT_FALSE(intersection1.coincides);
24 EXPECT_FALSE(intersection2.coincides);
25}
26
27TEST(LineTest, IntersectionMiddle) {
28 Line2F a({-5, 0}, {5, 0});

Callers

nothing calls this directly

Calls 4

vmagFunction · 0.85
distanceToMethod · 0.80
intersectionMethod · 0.45
makePositiveMethod · 0.45

Tested by

no test coverage detected