[Cppunit-cvs] cppunit2/examples/checking_assertions .cvsignore,NONE,1.1 main.cpp,NONE,1.1 SConscript
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-03-01 22:18:07
|
Update of /cvsroot/cppunit/cppunit2/examples/checking_assertions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15392/examples/checking_assertions Added Files: .cvsignore main.cpp SConscript Log Message: * added example that demonstrate the checking assertions. --- NEW FILE: .cvsignore --- *.plg *.old *.WW *.old --- NEW FILE: SConscript --- Import( 'env_testing buildCppUnitExample' ) buildCppUnitExample( env_testing, """ main.cpp """.split(), 'checking_assertions' ) --- NEW FILE: main.cpp --- #include <cpput/testcase.h> #include <cpput/testsuite.h> #include <cpput/testrunner.h> // cppunit2 testrunner for opentest #include <cpput/assert.h> #include <opentest/texttestdriver.h> #include <opentest/properties.h> // Checking assertion do not abort the test uppon failure: // all the failing assertions below will be reported by the test framework static void testBasicCheckingAssertion() { CPPUT_CHECK( 1 == 2, "1 is not equal to 2..." ); CPPUT_CHECK_EXPR( 1 + 2 == 4 ); CPPUT_CHECK_FALSE( 1 == 1, "1 is equal to 1..." ); CPPUT_CHECK_EXPR_FALSE( 1 + 1 == 2 ); CPPUT_CHECK_EQUAL( 1, 2 ); CPPUT_CHECK_NOT_EQUAL( 34, 34 ); } int main( int argc, const char *argv[] ) { CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); allSuite->add( CppUT::makeTestCase( CppTL::cfn0( &testBasicCheckingAssertion ), "testBasicCheckingAssertion" ) ); CppUT::TestRunner runner; CppUT::AbstractTestSuitePtr rootSuite = CppTL::staticPointerCast<CppUT::AbstractTestSuite>( allSuite ); runner.setRootSuite( rootSuite ); OpenTest::TextTestDriver driver( runner ); bool sucessful = driver.run(); return sucessful ? 0 : 1; } |