summaryrefslogtreecommitdiff
path: root/examples/cppunittest/TestAssertTest.cpp
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-05-05 21:52:20 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-07-13 10:57:18 +0200
commit0ef304e8b8cc517c6a1d8ddccfcaab49172c0535 (patch)
treeac70fc0fbf66629ec268d81d5f94c5c17d90e2f7 /examples/cppunittest/TestAssertTest.cpp
parent059fcd2878071616cedb5116a0b2f75b5edbdbe0 (diff)
downloadcppunit-0ef304e8b8cc517c6a1d8ddccfcaab49172c0535.tar.gz
add new assertion macros for <, <=, > and >=
Now we support the following new macros: - CPPUNIT_ASSERT_LESS - CPPUNIT_ASSERT_GREATER - CPPUNIT_ASSERT_LESSEQUAL - CPPUNIT_ASSERT_GREATEREQUAL
Diffstat (limited to 'examples/cppunittest/TestAssertTest.cpp')
-rw-r--r--examples/cppunittest/TestAssertTest.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/examples/cppunittest/TestAssertTest.cpp b/examples/cppunittest/TestAssertTest.cpp
index 1a7a5de..1516117 100644
--- a/examples/cppunittest/TestAssertTest.cpp
+++ b/examples/cppunittest/TestAssertTest.cpp
@@ -141,6 +141,51 @@ TestAssertTest::testAssertEqual()
CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_EQUAL( 1, 2 ) );
}
+
+void
+TestAssertTest::testAssertLess()
+{
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESS( 2, 1 ) );
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESS( 12345679, 12345678 ) );
+
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_LESS( 1, 2 ) );
+}
+
+
+void
+TestAssertTest::testAssertGreater()
+{
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATER( 1, 2 ) );
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATER( 12345678, 12345679 ));
+
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_GREATER( 2, 1 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_GREATER( 2, 2 ) );
+}
+
+
+void
+TestAssertTest::testAssertLessEqual()
+{
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESSEQUAL( 2, 1 ) );
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESSEQUAL( 12345679, 12345678 ));
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESSEQUAL( 2, 2 ) );
+
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_LESSEQUAL( 1, 2 ) );
+}
+
+void
+TestAssertTest::testAssertGreaterEqual()
+{
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATEREQUAL( 1, 2 ) );
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATEREQUAL( 12345678, 12345679 ));
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATEREQUAL( 12345678, 12345678 ));
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATEREQUAL( 2, 2 ) );
+
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_GREATEREQUAL( 2, 1 ) );
+}
+
+
+
void
TestAssertTest::testAssertMessageTrue()
{