MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_comparison_operators

Function test_comparison_operators

tests/geometry/test-angle.cpp:71–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void test_comparison_operators()
72{
73 auto angle60 = geode::Angle::create_from_degrees( 60.00 );
74 auto angle_almost60 = geode::Angle::create_from_degrees( 60.05 );
75 auto angle_not60 = geode::Angle::create_from_degrees( 60.07 );
76 auto angle30 = geode::Angle::create_from_degrees( 30.00 );
77
78 geode::OpenGeodeGeometryException::test( angle60 == angle60,
79 "Wrong == comparition angles ", std::to_string( angle60.degrees() ),
80 " and ", std::to_string( angle60.degrees() ), " should be equal !" );
81 geode::OpenGeodeGeometryException::test( !( angle60 == angle_not60 ),
82 "Wrong == comparition angles ", std::to_string( angle60.degrees() ),
83 " and ", std::to_string( angle_not60.degrees() ),
84 " should be equal !" );
85 geode::OpenGeodeGeometryException::test( !( angle60 == angle_almost60 ),
86 "Wrong == comparition angles ", std::to_string( angle60.degrees() ),
87 " and ", std::to_string( angle_almost60.degrees() ),
88 " should not be equal !" );
89
90 geode::OpenGeodeGeometryException::test( angle60.inexact_equal( angle60 ),
91 "Wrong inexact_equal comparition angles ",
92 std::to_string( angle60.degrees() ), " and ",
93 std::to_string( angle60.degrees() ), " should be equal !" );
94 geode::OpenGeodeGeometryException::test(
95 !( angle60.inexact_equal( angle_not60 ) ),
96 "Wrong inexact_equal comparition angles ",
97 std::to_string( angle60.degrees() ), " and ",
98 std::to_string( angle_not60.degrees() ), " should be equal !" );
99 geode::OpenGeodeGeometryException::test(
100 angle60.inexact_equal( angle_almost60 ),
101 "Wrong inexact_equal comparition angles ",
102 std::to_string( angle60.degrees() ), " and ",
103 std::to_string( angle_almost60.degrees() ), " should be equal !" );
104
105 geode::OpenGeodeGeometryException::test( angle_almost60 > angle60, "Wrong ",
106 std::to_string( angle_almost60.degrees() ), " >",
107 std::to_string( angle60.degrees() ),
108 " comparition should be higher !" );
109 geode::OpenGeodeGeometryException::test( angle_almost60 < angle_not60,
110 "Wrong ", std::to_string( angle_almost60.degrees() ), " < ",
111 std::to_string( angle_not60.degrees() ),
112 " comparition should be smaller !" );
113}
114
115void test_arithmetic()
116{

Callers 1

testFunction · 0.70

Calls 4

to_stringFunction · 0.85
degreesMethod · 0.80
testFunction · 0.70
inexact_equalMethod · 0.45

Tested by

no test coverage detected