diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-05 21:52:20 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-06 16:38:21 +0200 |
commit | 4dbaa35920fa376c48eedf8cc3440b3965a01caa (patch) | |
tree | a57b25baae810fba7594b764628405fada72bac1 /examples/cppunittest/TestAssertTest.cpp | |
parent | 7902eb988d167b6cddd88b6c5be4385b203080eb (diff) | |
download | cppunit-feature/new_assert_macros.tar.gz |
add new assertion macros for <, <=, > and >=feature/new_assert_macros
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.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/examples/cppunittest/TestAssertTest.cpp b/examples/cppunittest/TestAssertTest.cpp index 3960b8e..c990607 100644 --- a/examples/cppunittest/TestAssertTest.cpp +++ b/examples/cppunittest/TestAssertTest.cpp @@ -137,6 +137,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() { |