summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-06-13 17:17:42 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-06-13 17:17:42 +0000
commit7f0766499db248afe9985a5700c22f9a8ce7ce6c (patch)
treeba70577fe0ed4343b5127d1e8848cbe0ccebf4fe /examples
parentabd178318ae3cdb6cc0a700e77414a33ef9297ca (diff)
downloadcppunit-7f0766499db248afe9985a5700c22f9a8ce7ce6c.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.h: * src/cppunit/NotEqualException.cpp: removed. * include/cppunit/Exception.h: * src/cppunit/Exception.cpp: removed 'type' related stuffs. * include/cppunit/TextTestResult.h: * src/cppunit/TextTestResult.cpp: delegate printing to TextOutputter. * examples/simple/ExampleTestCase.h: * examples/simple/ExampleTestCase.cpp: reindented. * src/qttestrunner/build: * src/qttestrunner/qttestrunner.pro: * src/qttestrunner/TestBrowserDlgImpl.h: * src/qttestrunner/TestRunnerModel.h: applied Thomas Neidhart's patch, 'Some minor fixes to compile QTTestrunner under Linux.'.
Diffstat (limited to 'examples')
-rw-r--r--examples/cppunittest/CppUnitTestMain.dsp8
-rw-r--r--examples/cppunittest/CppUnitTestPlugIn.dsp8
-rw-r--r--examples/cppunittest/ExceptionTest.cpp11
-rw-r--r--examples/cppunittest/ExceptionTest.h2
-rw-r--r--examples/cppunittest/Makefile.am2
-rw-r--r--examples/cppunittest/NotEqualExceptionTest.cpp92
-rw-r--r--examples/cppunittest/NotEqualExceptionTest.h37
-rw-r--r--examples/cppunittest/XmlUniformiserTest.cpp14
-rw-r--r--examples/cppunittest/XmlUniformiserTest.h2
-rw-r--r--examples/examples.optbin200704 -> 150016 bytes
-rw-r--r--examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp9
-rw-r--r--examples/simple/ExampleTestCase.cpp52
-rw-r--r--examples/simple/ExampleTestCase.h20
13 files changed, 37 insertions, 220 deletions
diff --git a/examples/cppunittest/CppUnitTestMain.dsp b/examples/cppunittest/CppUnitTestMain.dsp
index acbbdd9..6969c52 100644
--- a/examples/cppunittest/CppUnitTestMain.dsp
+++ b/examples/cppunittest/CppUnitTestMain.dsp
@@ -190,14 +190,6 @@ SOURCE=.\MessageTest.h
# End Source File
# Begin Source File
-SOURCE=.\NotEqualExceptionTest.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\NotEqualExceptionTest.h
-# End Source File
-# Begin Source File
-
SOURCE=.\TestAssertTest.cpp
# End Source File
# Begin Source File
diff --git a/examples/cppunittest/CppUnitTestPlugIn.dsp b/examples/cppunittest/CppUnitTestPlugIn.dsp
index 5e117a7..58b8241 100644
--- a/examples/cppunittest/CppUnitTestPlugIn.dsp
+++ b/examples/cppunittest/CppUnitTestPlugIn.dsp
@@ -199,14 +199,6 @@ SOURCE=.\MessageTest.h
# End Source File
# Begin Source File
-SOURCE=.\NotEqualExceptionTest.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\NotEqualExceptionTest.h
-# End Source File
-# Begin Source File
-
SOURCE=.\TestAssertTest.cpp
# End Source File
# Begin Source File
diff --git a/examples/cppunittest/ExceptionTest.cpp b/examples/cppunittest/ExceptionTest.cpp
index e166130..c3d1876 100644
--- a/examples/cppunittest/ExceptionTest.cpp
+++ b/examples/cppunittest/ExceptionTest.cpp
@@ -1,7 +1,6 @@
#include "CoreSuite.h"
#include "ExceptionTest.h"
#include <cppunit/Exception.h>
-#include <cppunit/NotEqualException.h>
#include <memory>
@@ -86,16 +85,6 @@ ExceptionTest::testClone()
void
-ExceptionTest::testIsInstanceOf()
-{
- CppUnit::SourceLine sourceLine( "fileName.cpp", 123 );
- CppUnit::Exception e( CppUnit::Message("message"), sourceLine );
- CPPUNIT_ASSERT( e.isInstanceOf( CppUnit::Exception::type() ) );
- CPPUNIT_ASSERT( !e.isInstanceOf( CppUnit::NotEqualException::type() ) );
-}
-
-
-void
ExceptionTest::checkIsSame( CppUnit::Exception &e,
CppUnit::Exception &other )
{
diff --git a/examples/cppunittest/ExceptionTest.h b/examples/cppunittest/ExceptionTest.h
index 42134dd..41bcda2 100644
--- a/examples/cppunittest/ExceptionTest.h
+++ b/examples/cppunittest/ExceptionTest.h
@@ -12,7 +12,6 @@ class ExceptionTest : public CppUnit::TestFixture
CPPUNIT_TEST( testCopyConstructor );
CPPUNIT_TEST( testAssignment );
CPPUNIT_TEST( testClone );
- CPPUNIT_TEST( testIsInstanceOf );
CPPUNIT_TEST_SUITE_END();
public:
@@ -27,7 +26,6 @@ public:
void testCopyConstructor();
void testAssignment();
void testClone();
- void testIsInstanceOf();
private:
ExceptionTest( const ExceptionTest &copy );
diff --git a/examples/cppunittest/Makefile.am b/examples/cppunittest/Makefile.am
index c5a47a0..4dd2e69 100644
--- a/examples/cppunittest/Makefile.am
+++ b/examples/cppunittest/Makefile.am
@@ -24,8 +24,6 @@ cppunittestmain_SOURCES = \
MockTestCase.cpp \
MockTestListener.cpp \
MockTestListener.h \
- NotEqualExceptionTest.cpp \
- NotEqualExceptionTest.h \
OrthodoxTest.cpp \
OrthodoxTest.h \
OutputSuite.h \
diff --git a/examples/cppunittest/NotEqualExceptionTest.cpp b/examples/cppunittest/NotEqualExceptionTest.cpp
deleted file mode 100644
index 838ca6e..0000000
--- a/examples/cppunittest/NotEqualExceptionTest.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "CoreSuite.h"
-#include "NotEqualExceptionTest.h"
-#include <cppunit/NotEqualException.h>
-
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( NotEqualExceptionTest,
- CppUnitTest::coreSuiteName() );
-
-
-NotEqualExceptionTest::NotEqualExceptionTest()
-{
-}
-
-
-NotEqualExceptionTest::~NotEqualExceptionTest()
-{
-}
-
-
-void
-NotEqualExceptionTest::setUp()
-{
-}
-
-
-void
-NotEqualExceptionTest::tearDown()
-{
-}
-
-
-
-void
-NotEqualExceptionTest::testConstructor()
-{
- std::string expectedValue( "expectedValue" );
- std::string actualValue( "actualValue" );
- std::string message( "message" );
- CppUnit::NotEqualException e( expectedValue,
- actualValue,
- CppUnit::SourceLine( "f.cpp", 123),
- message );
-
- CPPUNIT_ASSERT_EQUAL( expectedValue, e.expectedValue() );
- CPPUNIT_ASSERT_EQUAL( actualValue, e.actualValue() );
- CPPUNIT_ASSERT_EQUAL( message, e.additionalMessage() );
- CPPUNIT_ASSERT( CppUnit::SourceLine( "f.cpp", 123) == e.sourceLine() );
-
- CppUnit::Message expectedMessage( "equality assertion failed",
- "Expected: " + expectedValue,
- "Actual : " + actualValue,
- message );
- CppUnit::Message actualMessage( e.message() );
- CPPUNIT_ASSERT( expectedMessage == actualMessage );
-}
-
-
-void
-NotEqualExceptionTest::testClone()
-{
- CppUnit::NotEqualException e( "expectedValue",
- "actualValue",
- CppUnit::SourceLine("file.cpp", 2),
- "add-message" );
- std::auto_ptr<CppUnit::NotEqualException>
- other( (CppUnit::NotEqualException *)e.clone() );
- CPPUNIT_ASSERT_EQUAL( std::string( e.what() ),
- std::string( other->what() ) );
-}
-
-
-void
-NotEqualExceptionTest::testIsInstanceOf()
-{
- CppUnit::NotEqualException e( "expectedValue", "actualValue" );
- CPPUNIT_ASSERT( e.isInstanceOf( CppUnit::NotEqualException::type() ) );
- CPPUNIT_ASSERT( e.isInstanceOf( CppUnit::Exception::type() ) );
-}
-
-
-void
-NotEqualExceptionTest::testAssignment()
-{
- CppUnit::NotEqualException e( "expectedValue",
- "actualValue",
- CppUnit::SourceLine("file.cpp", 2),
- "add-message" );
- CppUnit::NotEqualException other( "", "" );
- other = e;
- CPPUNIT_ASSERT_EQUAL( std::string( e.what() ),
- std::string( other.what() ) );
-}
diff --git a/examples/cppunittest/NotEqualExceptionTest.h b/examples/cppunittest/NotEqualExceptionTest.h
deleted file mode 100644
index 2f7e284..0000000
--- a/examples/cppunittest/NotEqualExceptionTest.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef NOTEQUALEXCEPTIONTEST_H
-#define NOTEQUALEXCEPTIONTEST_H
-
-#include <cppunit/extensions/HelperMacros.h>
-
-
-class NotEqualExceptionTest : public CppUnit::TestFixture
-{
- CPPUNIT_TEST_SUITE( NotEqualExceptionTest );
- CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testClone );
- CPPUNIT_TEST( testIsInstanceOf );
- CPPUNIT_TEST( testAssignment );
- CPPUNIT_TEST_SUITE_END();
-
-public:
- NotEqualExceptionTest();
- virtual ~NotEqualExceptionTest();
-
- virtual void setUp();
- virtual void tearDown();
-
- void testConstructor();
- void testClone();
- void testIsInstanceOf();
- void testAssignment();
-
-private:
- NotEqualExceptionTest( const NotEqualExceptionTest &copy );
- void operator =( const NotEqualExceptionTest &copy );
-
-private:
-};
-
-
-
-#endif // NOTEQUALEXCEPTIONTEST_H
diff --git a/examples/cppunittest/XmlUniformiserTest.cpp b/examples/cppunittest/XmlUniformiserTest.cpp
index 300ca6b..d99b457 100644
--- a/examples/cppunittest/XmlUniformiserTest.cpp
+++ b/examples/cppunittest/XmlUniformiserTest.cpp
@@ -1,4 +1,3 @@
-#include <cppunit/NotEqualException.h>
#include <stdlib.h>
#include "UnitTestToolSuite.h"
#include "XmlUniformiserTest.h"
@@ -129,18 +128,7 @@ XmlUniformiserTest::testSkipComment()
void
XmlUniformiserTest::testAssertXmlEqualFail()
{
- try
- {
- CPPUNITTEST_ASSERT_XML_EQUAL( "<Test>", "<Tes>" );
- CPPUNIT_FAIL( "CppUnit::NotEqualException expected" );
- }
- catch ( CppUnit::NotEqualException &e )
- {
- CPPUNIT_ASSERT_EQUAL( e.expectedValue(), std::string("<Test>" ) );
- CPPUNIT_ASSERT_EQUAL( e.actualValue(), std::string("<Tes>" ) );
- CPPUNIT_ASSERT( !e.additionalMessage().empty() );
- CPPUNIT_ASSERT( e.sourceLine().isValid() );
- }
+ CPPUNITTEST_ASSERT_XML_EQUAL( "<Test>", "<Tes>" );
}
void
diff --git a/examples/cppunittest/XmlUniformiserTest.h b/examples/cppunittest/XmlUniformiserTest.h
index d9505b3..d590505 100644
--- a/examples/cppunittest/XmlUniformiserTest.h
+++ b/examples/cppunittest/XmlUniformiserTest.h
@@ -21,7 +21,7 @@ class XmlUniformiserTest : public CppUnit::TestFixture
CPPUNIT_TEST( testSkipComment );
CPPUNIT_TEST( testElementWithContent );
CPPUNIT_TEST( testElementsHierarchyWithContents );
- CPPUNIT_TEST( testAssertXmlEqualFail );
+ CPPUNIT_TEST_FAIL( testAssertXmlEqualFail );
CPPUNIT_TEST( testAssertXmlEqualPass );
CPPUNIT_TEST_SUITE_END();
diff --git a/examples/examples.opt b/examples/examples.opt
index c7bafd6..93cc6ce 100644
--- a/examples/examples.opt
+++ b/examples/examples.opt
Binary files differ
diff --git a/examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp b/examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp
index 543d848..af80119 100644
--- a/examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp
+++ b/examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp
@@ -267,15 +267,6 @@ SOURCE=..\..\cppunittest\MockTestListener.h
# End Source File
# Begin Source File
-SOURCE=..\..\cppunittest\NotEqualExceptionTest.cpp
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\cppunittest\NotEqualExceptionTest.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\cppunittest\OrthodoxTest.cpp
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
diff --git a/examples/simple/ExampleTestCase.cpp b/examples/simple/ExampleTestCase.cpp
index a71b7bd..838b2d0 100644
--- a/examples/simple/ExampleTestCase.cpp
+++ b/examples/simple/ExampleTestCase.cpp
@@ -2,49 +2,49 @@
CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase );
-void ExampleTestCase::example ()
+void ExampleTestCase::example()
{
- CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05);
- CPPUNIT_ASSERT (1 == 0);
- CPPUNIT_ASSERT (1 == 1);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, 1.1, 0.05 );
+ CPPUNIT_ASSERT( 1 == 0 );
+ CPPUNIT_ASSERT( 1 == 1 );
}
-void ExampleTestCase::anotherExample ()
+void ExampleTestCase::anotherExample()
{
- CPPUNIT_ASSERT (1 == 2);
+ CPPUNIT_ASSERT (1 == 2);
}
-void ExampleTestCase::setUp ()
+void ExampleTestCase::setUp()
{
- m_value1 = 2.0;
- m_value2 = 3.0;
+ m_value1 = 2.0;
+ m_value2 = 3.0;
}
-void ExampleTestCase::testAdd ()
+void ExampleTestCase::testAdd()
{
- double result = m_value1 + m_value2;
- CPPUNIT_ASSERT (result == 6.0);
+ double result = m_value1 + m_value2;
+ CPPUNIT_ASSERT( result == 6.0 );
}
-void ExampleTestCase::testDivideByZero ()
+void ExampleTestCase::testDivideByZero()
{
- int zero = 0;
- int result = 8 / zero;
+ int zero = 0;
+ int result = 8 / zero;
}
-void ExampleTestCase::testEquals ()
+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);
+ 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 );
}
diff --git a/examples/simple/ExampleTestCase.h b/examples/simple/ExampleTestCase.h
index b5d89e9..2531d32 100644
--- a/examples/simple/ExampleTestCase.h
+++ b/examples/simple/ExampleTestCase.h
@@ -20,22 +20,20 @@ class ExampleTestCase : public CppUnit::TestCase
CPPUNIT_TEST( testDivideByZero );
CPPUNIT_TEST( testEquals );
CPPUNIT_TEST_SUITE_END();
-protected:
- double m_value1;
- double m_value2;
+protected:
+ double m_value1;
+ double m_value2;
public:
-
- void setUp ();
+ void setUp();
protected:
- void example ();
- void anotherExample ();
- void testAdd ();
- void testDivideByZero ();
- void testEquals ();
-
+ void example();
+ void anotherExample();
+ void testAdd();
+ void testDivideByZero();
+ void testEquals();
};