mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-30 19:57:10 +01:00 
			
		
		
		
	Add constructor arg checking to WithinAbsMatcher
Also tests :-)
This commit is contained in:
		| @@ -298,6 +298,13 @@ namespace { namespace MatchersTests { | ||||
|  | ||||
|                 REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))); | ||||
|             } | ||||
|             SECTION("Constructor validation") { | ||||
|                 REQUIRE_NOTHROW(WithinAbs(1.f, 0.f)); | ||||
|                 REQUIRE_THROWS_AS(WithinAbs(1.f, -1.f), std::domain_error); | ||||
|  | ||||
|                 REQUIRE_NOTHROW(WithinULP(1.f, 0)); | ||||
|                 REQUIRE_THROWS_AS(WithinULP(1.f, -1), std::domain_error); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         TEST_CASE("Floating point matchers: double", "[matchers][floating-point]") { | ||||
| @@ -328,6 +335,13 @@ namespace { namespace MatchersTests { | ||||
|  | ||||
|                 REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))); | ||||
|             } | ||||
|             SECTION("Constructor validation") { | ||||
|                 REQUIRE_NOTHROW(WithinAbs(1., 0.)); | ||||
|                 REQUIRE_THROWS_AS(WithinAbs(1., -1.), std::domain_error); | ||||
|  | ||||
|                 REQUIRE_NOTHROW(WithinULP(1., 0)); | ||||
|                 REQUIRE_THROWS_AS(WithinULP(1., -1), std::domain_error); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| } } // namespace MatchersTests | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský