summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-11-07 05:41:20 -0800
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-11-07 06:06:09 -0800
commit5cb290d77a3539a492eac43202f27ecd150c99a0 (patch)
tree794065d4987c1b226209dd30b24830b80a47e6b2 /examples
parentc5813be8793da22ec25e4dfdf9d6dec43695cbeb (diff)
add a flag for adding optional features
These features will switch the used C++ version from C++03 to C++11. We are also going to use std::unique_ptr instead of std::auto_ptr for the c++11 mode.
Diffstat (limited to 'examples')
-rw-r--r--examples/cppunittest/ExceptionTest.cpp4
-rw-r--r--examples/cppunittest/HelperMacrosTest.cpp18
-rw-r--r--examples/msvc6/HostApp/ExampleTestCase.cpp11
-rw-r--r--examples/qt/ExampleTestCases.cpp5
4 files changed, 20 insertions, 18 deletions
diff --git a/examples/cppunittest/ExceptionTest.cpp b/examples/cppunittest/ExceptionTest.cpp
index 31dce64..856f561 100644
--- a/examples/cppunittest/ExceptionTest.cpp
+++ b/examples/cppunittest/ExceptionTest.cpp
@@ -1,7 +1,7 @@
#include "CoreSuite.h"
#include "ExceptionTest.h"
+#include <cppunit/portability/SmartPtr.h>
#include <cppunit/Exception.h>
-#include <memory>
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ExceptionTest,
@@ -79,7 +79,7 @@ ExceptionTest::testClone()
{
CPPUNIT_NS::SourceLine sourceLine( "fileName.cpp", 123 );
CPPUNIT_NS::Exception e( CPPUNIT_NS::Message("message"), sourceLine );
- std::auto_ptr<CPPUNIT_NS::Exception> other( e.clone() );
+ CppUnitSmartPtr<CPPUNIT_NS::Exception> other( e.clone() );
checkIsSame( e, *other.get() );
}
diff --git a/examples/cppunittest/HelperMacrosTest.cpp b/examples/cppunittest/HelperMacrosTest.cpp
index b88dec6..0e2a8b8 100644
--- a/examples/cppunittest/HelperMacrosTest.cpp
+++ b/examples/cppunittest/HelperMacrosTest.cpp
@@ -5,7 +5,7 @@
#include "MockTestCase.h"
#include "SubclassedTestCase.h"
#include <cppunit/TestResult.h>
-#include <memory>
+#include <cppunit/portability/SmartPtr.h>
/* Note:
- no unit test for CPPUNIT_TEST_SUITE_REGISTRATION...
@@ -132,7 +132,7 @@ HelperMacrosTest::tearDown()
void
HelperMacrosTest::testNoSubclassing()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( BaseTestCase::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( BaseTestCase::suite() );
CPPUNIT_ASSERT_EQUAL( 1, suite->countTestCases() );
m_testListener->setExpectedStartTestCall( 1 );
m_testListener->setExpectNoFailure();
@@ -145,7 +145,7 @@ HelperMacrosTest::testNoSubclassing()
void
HelperMacrosTest::testSubclassing()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( SubclassedTestCase::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( SubclassedTestCase::suite() );
CPPUNIT_ASSERT_EQUAL( 2, suite->countTestCases() );
m_testListener->setExpectedStartTestCall( 2 );
m_testListener->setExpectedAddFailureCall( 1 );
@@ -158,7 +158,7 @@ HelperMacrosTest::testSubclassing()
void
HelperMacrosTest::testFail()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( FailTestFixture::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( FailTestFixture::suite() );
m_testListener->setExpectedStartTestCall( 1 );
m_testListener->setExpectNoFailure();
@@ -170,7 +170,7 @@ HelperMacrosTest::testFail()
void
HelperMacrosTest::testFailToFail()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( FailToFailTestFixture::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( FailToFailTestFixture::suite() );
m_testListener->setExpectedStartTestCall( 1 );
m_testListener->setExpectedAddFailureCall( 1 );
@@ -182,7 +182,7 @@ HelperMacrosTest::testFailToFail()
void
HelperMacrosTest::testException()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( ExceptionTestFixture::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( ExceptionTestFixture::suite() );
m_testListener->setExpectedStartTestCall( 1 );
m_testListener->setExpectNoFailure();
@@ -194,7 +194,7 @@ HelperMacrosTest::testException()
void
HelperMacrosTest::testExceptionNotCaught()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( ExceptionNotCaughtTestFixture::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( ExceptionNotCaughtTestFixture::suite() );
m_testListener->setExpectedStartTestCall( 1 );
m_testListener->setExpectedAddFailureCall( 1 );
@@ -206,7 +206,7 @@ HelperMacrosTest::testExceptionNotCaught()
void
HelperMacrosTest::testCustomTests()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( CustomsTestTestFixture::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( CustomsTestTestFixture::suite() );
m_testListener->setExpectedStartTestCall( 2 );
m_testListener->setExpectedAddFailureCall( 1 );
@@ -218,7 +218,7 @@ HelperMacrosTest::testCustomTests()
void
HelperMacrosTest::testAddTest()
{
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( AddTestTestFixture::suite() );
+ CppUnitSmartPtr<CPPUNIT_NS::TestSuite> suite( AddTestTestFixture::suite() );
m_testListener->setExpectedStartTestCall( 7 );
m_testListener->setExpectedAddFailureCall( 0 );
diff --git a/examples/msvc6/HostApp/ExampleTestCase.cpp b/examples/msvc6/HostApp/ExampleTestCase.cpp
index ec13319..727fd30 100644
--- a/examples/msvc6/HostApp/ExampleTestCase.cpp
+++ b/examples/msvc6/HostApp/ExampleTestCase.cpp
@@ -1,4 +1,5 @@
#include "ExampleTestCase.h"
+#include <cppunit/portability/SmartPtr.h>
CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase );
@@ -31,14 +32,14 @@ void ExampleTestCase::testAdd ()
void ExampleTestCase::testEquals ()
{
- std::auto_ptr<long> l1 (new long (12));
- std::auto_ptr<long> l2 (new long (12));
+ CppUnitSmartPtr<long> l1 (new long (12));
+ CppUnitSmartPtr<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);
+ CPPUNIT_ASSERT (12L == 12L);
+ CPPUNIT_ASSERT_EQUAL (12, 13);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, 11.99, 0.5);
}
diff --git a/examples/qt/ExampleTestCases.cpp b/examples/qt/ExampleTestCases.cpp
index edd67b0..03f1593 100644
--- a/examples/qt/ExampleTestCases.cpp
+++ b/examples/qt/ExampleTestCases.cpp
@@ -1,4 +1,5 @@
#include "ExampleTestCases.h"
+#include <cppunit/portability/SmartPtr.h>
CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCases );
@@ -28,8 +29,8 @@ void ExampleTestCases::testAdd ()
void ExampleTestCases::testEquals ()
{
- std::auto_ptr<long> l1 (new long (12));
- std::auto_ptr<long> l2 (new long (12));
+ CppUnitSmartPtr<long> l1 (new long (12));
+ CppUnitSmartPtr<long> l2 (new long (12));
CPPUNIT_ASSERT_EQUAL (12, 12);
CPPUNIT_ASSERT_EQUAL (12L, 12L);