summaryrefslogtreecommitdiff
path: root/examples/cppunittest/TestAssertTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cppunittest/TestAssertTest.cpp')
-rw-r--r--examples/cppunittest/TestAssertTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/cppunittest/TestAssertTest.cpp b/examples/cppunittest/TestAssertTest.cpp
index 6378e40..6941901 100644
--- a/examples/cppunittest/TestAssertTest.cpp
+++ b/examples/cppunittest/TestAssertTest.cpp
@@ -171,6 +171,17 @@ TestAssertTest::testAssertDoubleEquals()
CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.1, 1.2, 0.09 ) );
CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.2, 1.1, 0.09 ) );
+
+ double inf = std::numeric_limits<double>::infinity();
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, 0.0, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, inf, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, inf, 1.0 ) );
+
+ double nan = std::numeric_limits<double>::quiet_NaN();
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, 0.0, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, inf, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, nan, 1.0 ) );
}