MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / TEST

Function TEST

CPP/Tests/TestRect.cpp:6–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace Clipper2Lib;
5
6TEST(Clipper2Tests, TestRectOpPlus)
7{
8 {
9 Rect64 lhs = Rect64::InvalidRect();
10 Rect64 rhs(-1, -1, 10, 10);
11 {
12 Rect64 sum = lhs + rhs;
13 EXPECT_EQ(rhs, sum);
14 }
15 {
16 std::swap(lhs, rhs);
17 Rect64 sum = lhs + rhs;
18 EXPECT_EQ(lhs, sum);
19 }
20 }
21 {
22 Rect64 lhs = Rect64::InvalidRect();
23 Rect64 rhs(1, 1, 10, 10);
24 {
25 Rect64 sum = lhs + rhs;
26 EXPECT_EQ(rhs, sum);
27 }
28 {
29 std::swap(lhs, rhs);
30 Rect64 sum = lhs + rhs;
31 EXPECT_EQ(lhs, sum);
32 }
33 }
34 {
35 Rect64 lhs(0, 0, 1, 1);
36 Rect64 rhs(-1, -1, 0, 0);
37 Rect64 expected(-1, -1, 1, 1);
38 {
39 Rect64 sum = lhs + rhs;
40 EXPECT_EQ(expected, sum);
41 }
42 {
43 std::swap(lhs, rhs);
44 Rect64 sum = lhs + rhs;
45 EXPECT_EQ(expected, sum);
46 }
47 }
48 {
49 Rect64 lhs(-10, -10, -1, -1);
50 Rect64 rhs(1, 1, 10, 10);
51 Rect64 expected(-10, -10, 10, 10);
52 {
53 Rect64 sum = lhs + rhs;
54 EXPECT_EQ(expected, sum);
55 }
56 {
57 std::swap(lhs, rhs);
58 Rect64 sum = lhs + rhs;
59 EXPECT_EQ(expected, sum);
60 }
61 }
62}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected