From 0c5051a8acf83fd77a6094177eb0711d3f90d997 Mon Sep 17 00:00:00 2001 From: Baptiste Lepilleur Date: Mon, 11 Jun 2001 18:56:23 +0000 Subject: Examples/cppunittest/TestResultTest. examples/cppunittest/TestResultTest.*: renamed TestListenerTest.* * examples/cppunittest/*: added unit tests for: HelperMacros, TestAssert, TestCaller, TestCase, TestFailure, TestResult, TestSuite, TestDecoratorTest, TestSetUp, RepeatedTestTest, Orthodox, Exception. --- examples/cppunittest/OrthodoxTest.cpp | 109 ++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 examples/cppunittest/OrthodoxTest.cpp (limited to 'examples/cppunittest/OrthodoxTest.cpp') diff --git a/examples/cppunittest/OrthodoxTest.cpp b/examples/cppunittest/OrthodoxTest.cpp new file mode 100644 index 0000000..5e472df --- /dev/null +++ b/examples/cppunittest/OrthodoxTest.cpp @@ -0,0 +1,109 @@ +#include "OrthodoxTest.h" +#include +#include + +CPPUNIT_TEST_SUITE_REGISTRATION( OrthodoxTest ); + +OrthodoxTest::OrthodoxTest() +{ +} + + +OrthodoxTest::~OrthodoxTest() +{ +} + + +void +OrthodoxTest::setUp() +{ + m_result = new CppUnit::TestResult(); +} + + +void +OrthodoxTest::tearDown() +{ + delete m_result; +} + + +void +OrthodoxTest::testValue() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkSuccess(); +} + + +void +OrthodoxTest::testValueBadConstructor() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkFailure(); +} + + +void +OrthodoxTest::testValueBadInvert() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkFailure(); +} + + +void +OrthodoxTest::testValueBadEqual() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkFailure(); +} + + +void +OrthodoxTest::testValueBadNotEqual() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkFailure(); +} + + +void +OrthodoxTest::testValueBadCall() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkFailure(); +} + + +void +OrthodoxTest::testValueBadAssignment() +{ + CppUnit::Orthodox test; + test.run( m_result ); + checkFailure(); +} + + +void +OrthodoxTest::checkSuccess() +{ + CPPUNIT_ASSERT_EQUAL( 0, m_result->testErrors() ); + CPPUNIT_ASSERT_EQUAL( 0, m_result->testFailures() ); + CPPUNIT_ASSERT( m_result->runTests() > 0 ); +} + + +void +OrthodoxTest::checkFailure() +{ + CPPUNIT_ASSERT( m_result->testErrors() > 0 || + m_result->testFailures() > 0 ); +} + -- cgit v1.2.1