diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-10-14 11:23:31 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-10-14 11:23:31 +0000 |
| commit | e27118dd97d6125d3869b4972eff8da5996a768c (patch) | |
| tree | c15c08831fe1694f6d2298f1573f3fbb02724dc5 /examples/qt/ExampleTestCase.cpp | |
| parent | ff0517a7f94155d1c349c1f241b5f2bf5ba57cd7 (diff) | |
| download | cppunit-e27118dd97d6125d3869b4972eff8da5996a768c.tar.gz | |
Include/cppunitui/
include/cppunitui/* : added, Qt TestRunner.
* examples/qt/* : added, example showing the use of Qt TestRunner.
* src/qttestrunner : added, source of the Qt TestRunner DLL.
Diffstat (limited to 'examples/qt/ExampleTestCase.cpp')
| -rw-r--r-- | examples/qt/ExampleTestCase.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/qt/ExampleTestCase.cpp b/examples/qt/ExampleTestCase.cpp new file mode 100644 index 0000000..a71b7bd --- /dev/null +++ b/examples/qt/ExampleTestCase.cpp @@ -0,0 +1,50 @@ +#include "ExampleTestCase.h" + +CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase ); + +void ExampleTestCase::example () +{ + CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05); + CPPUNIT_ASSERT (1 == 0); + CPPUNIT_ASSERT (1 == 1); +} + + +void ExampleTestCase::anotherExample () +{ + CPPUNIT_ASSERT (1 == 2); +} + +void ExampleTestCase::setUp () +{ + m_value1 = 2.0; + m_value2 = 3.0; +} + +void ExampleTestCase::testAdd () +{ + double result = m_value1 + m_value2; + CPPUNIT_ASSERT (result == 6.0); +} + + +void ExampleTestCase::testDivideByZero () +{ + int zero = 0; + int result = 8 / zero; +} + + +void ExampleTestCase::testEquals () +{ + std::auto_ptr<long> l1 (new long (12)); + std::auto_ptr<long> l2 (new long (12)); + + CPPUNIT_ASSERT_EQUAL (12, 12); + CPPUNIT_ASSERT_EQUAL (12L, 12L); + CPPUNIT_ASSERT_EQUAL (*l1, *l2); + + CPPUNIT_ASSERT (12L == 12L); + CPPUNIT_ASSERT_EQUAL (12, 13); + CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, 11.99, 0.5); +} |
