mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 13:47:10 +01:00
submitted 1.2.0
This commit is contained in:
190
Foundation/testsuite/src/ActiveDispatcherTest.cpp
Normal file
190
Foundation/testsuite/src/ActiveDispatcherTest.cpp
Normal file
@@ -0,0 +1,190 @@
|
||||
//
|
||||
// ActiveDispatcherTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ActiveDispatcherTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Redistributions in any form must be accompanied by information on
|
||||
// how to obtain complete source code for this software and any
|
||||
// accompanying software that uses this software. The source code
|
||||
// must either be included in the distribution or be available for no
|
||||
// more than the cost of distribution plus a nominal fee, and must be
|
||||
// freely redistributable under reasonable conditions. For an
|
||||
// executable file, complete source code means the source code for all
|
||||
// modules it contains. It does not include source code for modules or
|
||||
// files that typically accompany the major components of the operating
|
||||
// system on which the executable file runs.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
#include "ActiveDispatcherTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/ActiveDispatcher.h"
|
||||
#include "Poco/ActiveMethod.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Poco::ActiveDispatcher;
|
||||
using Poco::ActiveMethod;
|
||||
using Poco::ActiveResult;
|
||||
using Poco::ActiveStarter;
|
||||
using Poco::Thread;
|
||||
using Poco::Event;
|
||||
using Poco::Exception;
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
class ActiveObject: public ActiveDispatcher
|
||||
{
|
||||
public:
|
||||
ActiveObject():
|
||||
testMethod(this, &ActiveObject::testMethodImpl)
|
||||
{
|
||||
}
|
||||
|
||||
~ActiveObject()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMethod<int, int, ActiveObject, ActiveStarter<ActiveDispatcher> > testMethod;
|
||||
|
||||
void cont()
|
||||
{
|
||||
_continue.set();
|
||||
}
|
||||
|
||||
protected:
|
||||
int testMethodImpl(const int& n)
|
||||
{
|
||||
if (n == 100) throw Exception("n == 100");
|
||||
_continue.wait();
|
||||
return n;
|
||||
}
|
||||
|
||||
private:
|
||||
Event _continue;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
ActiveDispatcherTest::ActiveDispatcherTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ActiveDispatcherTest::~ActiveDispatcherTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ActiveDispatcherTest::testWait()
|
||||
{
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(123);
|
||||
assert (!result.available());
|
||||
activeObj.cont();
|
||||
result.wait();
|
||||
assert (result.available());
|
||||
assert (result.data() == 123);
|
||||
assert (!result.failed());
|
||||
}
|
||||
|
||||
|
||||
void ActiveDispatcherTest::testWaitInterval()
|
||||
{
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(123);
|
||||
assert (!result.available());
|
||||
try
|
||||
{
|
||||
result.wait(100);
|
||||
fail("wait must fail");
|
||||
}
|
||||
catch (Exception&)
|
||||
{
|
||||
}
|
||||
activeObj.cont();
|
||||
result.wait(10000);
|
||||
assert (result.available());
|
||||
assert (result.data() == 123);
|
||||
assert (!result.failed());
|
||||
}
|
||||
|
||||
|
||||
void ActiveDispatcherTest::testTryWait()
|
||||
{
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(123);
|
||||
assert (!result.available());
|
||||
assert (!result.tryWait(200));
|
||||
activeObj.cont();
|
||||
assert (result.tryWait(10000));
|
||||
assert (result.available());
|
||||
assert (result.data() == 123);
|
||||
assert (!result.failed());
|
||||
}
|
||||
|
||||
|
||||
void ActiveDispatcherTest::testFailure()
|
||||
{
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(100);
|
||||
result.wait();
|
||||
assert (result.available());
|
||||
assert (result.failed());
|
||||
std::string msg = result.error();
|
||||
assert (msg == "n == 100");
|
||||
}
|
||||
|
||||
|
||||
void ActiveDispatcherTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ActiveDispatcherTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* ActiveDispatcherTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ActiveDispatcherTest");
|
||||
|
||||
CppUnit_addTest(pSuite, ActiveDispatcherTest, testWait);
|
||||
CppUnit_addTest(pSuite, ActiveDispatcherTest, testWaitInterval);
|
||||
CppUnit_addTest(pSuite, ActiveDispatcherTest, testTryWait);
|
||||
CppUnit_addTest(pSuite, ActiveDispatcherTest, testFailure);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
76
Foundation/testsuite/src/ActiveDispatcherTest.h
Normal file
76
Foundation/testsuite/src/ActiveDispatcherTest.h
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ActiveDispatcherTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ActiveDispatcherTest.h#1 $
|
||||
//
|
||||
// Definition of the ActiveDispatcherTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Redistributions in any form must be accompanied by information on
|
||||
// how to obtain complete source code for this software and any
|
||||
// accompanying software that uses this software. The source code
|
||||
// must either be included in the distribution or be available for no
|
||||
// more than the cost of distribution plus a nominal fee, and must be
|
||||
// freely redistributable under reasonable conditions. For an
|
||||
// executable file, complete source code means the source code for all
|
||||
// modules it contains. It does not include source code for modules or
|
||||
// files that typically accompany the major components of the operating
|
||||
// system on which the executable file runs.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ActiveDispatcherTest_INCLUDED
|
||||
#define ActiveDispatcherTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class ActiveDispatcherTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
ActiveDispatcherTest(const std::string& name);
|
||||
~ActiveDispatcherTest();
|
||||
|
||||
void testWait();
|
||||
void testWaitInterval();
|
||||
void testTryWait();
|
||||
void testFailure();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // ActiveDispatcherTest_INCLUDED
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ActiveMethodTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ActiveMethodTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ActiveMethodTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,49 +33,52 @@
|
||||
#include "ActiveMethodTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/ActiveMethod.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Foundation/Event.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/ActiveMethod.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Foundation::ActiveMethod;
|
||||
using Foundation::ActiveResult;
|
||||
using Foundation::Thread;
|
||||
using Foundation::Event;
|
||||
using Foundation::Exception;
|
||||
using Poco::ActiveMethod;
|
||||
using Poco::ActiveResult;
|
||||
using Poco::Thread;
|
||||
using Poco::Event;
|
||||
using Poco::Exception;
|
||||
|
||||
|
||||
class ActiveObject2
|
||||
namespace
|
||||
{
|
||||
public:
|
||||
ActiveObject2():
|
||||
testMethod(this, &ActiveObject2::testMethodImp)
|
||||
class ActiveObject
|
||||
{
|
||||
}
|
||||
|
||||
~ActiveObject2()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMethod<int, int, ActiveObject2> testMethod;
|
||||
|
||||
void cont()
|
||||
{
|
||||
_continue.set();
|
||||
}
|
||||
|
||||
protected:
|
||||
int testMethodImp(const int& n)
|
||||
{
|
||||
if (n == 100) throw Exception("n == 100");
|
||||
_continue.wait();
|
||||
return n;
|
||||
}
|
||||
|
||||
private:
|
||||
Event _continue;
|
||||
};
|
||||
public:
|
||||
ActiveObject():
|
||||
testMethod(this, &ActiveObject::testMethodImpl)
|
||||
{
|
||||
}
|
||||
|
||||
~ActiveObject()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMethod<int, int, ActiveObject> testMethod;
|
||||
|
||||
void cont()
|
||||
{
|
||||
_continue.set();
|
||||
}
|
||||
|
||||
protected:
|
||||
int testMethodImpl(const int& n)
|
||||
{
|
||||
if (n == 100) throw Exception("n == 100");
|
||||
_continue.wait();
|
||||
return n;
|
||||
}
|
||||
|
||||
private:
|
||||
Event _continue;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
ActiveMethodTest::ActiveMethodTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -90,7 +93,7 @@ ActiveMethodTest::~ActiveMethodTest()
|
||||
|
||||
void ActiveMethodTest::testWait()
|
||||
{
|
||||
ActiveObject2 activeObj;
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(123);
|
||||
assert (!result.available());
|
||||
activeObj.cont();
|
||||
@@ -103,7 +106,7 @@ void ActiveMethodTest::testWait()
|
||||
|
||||
void ActiveMethodTest::testWaitInterval()
|
||||
{
|
||||
ActiveObject2 activeObj;
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(123);
|
||||
assert (!result.available());
|
||||
try
|
||||
@@ -124,7 +127,7 @@ void ActiveMethodTest::testWaitInterval()
|
||||
|
||||
void ActiveMethodTest::testTryWait()
|
||||
{
|
||||
ActiveObject2 activeObj;
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(123);
|
||||
assert (!result.available());
|
||||
assert (!result.tryWait(200));
|
||||
@@ -138,7 +141,7 @@ void ActiveMethodTest::testTryWait()
|
||||
|
||||
void ActiveMethodTest::testFailure()
|
||||
{
|
||||
ActiveObject2 activeObj;
|
||||
ActiveObject activeObj;
|
||||
ActiveResult<int> result = activeObj.testMethod(100);
|
||||
result.wait();
|
||||
assert (result.available());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ActiveMethodTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ActiveMethodTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ActiveMethodTest.h#1 $
|
||||
//
|
||||
// Definition of the ActiveMethodTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define ActiveMethodTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ActiveMethodTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ActivityTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ActivityTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ActivityTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,48 +33,51 @@
|
||||
#include "ActivityTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/Activity.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Poco/Activity.h"
|
||||
#include "Poco/Thread.h"
|
||||
|
||||
|
||||
using Foundation::Activity;
|
||||
using Foundation::Thread;
|
||||
using Poco::Activity;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
class ActiveObject
|
||||
namespace
|
||||
{
|
||||
public:
|
||||
ActiveObject():
|
||||
_activity(this, &ActiveObject::run),
|
||||
_count(0)
|
||||
class ActiveObject
|
||||
{
|
||||
}
|
||||
|
||||
~ActiveObject()
|
||||
{
|
||||
}
|
||||
|
||||
Activity<ActiveObject>& activity()
|
||||
{
|
||||
return _activity;
|
||||
}
|
||||
|
||||
int count() const
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
public:
|
||||
ActiveObject():
|
||||
_activity(this, &ActiveObject::run),
|
||||
_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
~ActiveObject()
|
||||
{
|
||||
}
|
||||
|
||||
Activity<ActiveObject>& activity()
|
||||
{
|
||||
return _activity;
|
||||
}
|
||||
|
||||
int count() const
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
protected:
|
||||
void run()
|
||||
{
|
||||
while (!_activity.isStopped())
|
||||
++_count;
|
||||
}
|
||||
protected:
|
||||
void run()
|
||||
{
|
||||
while (!_activity.isStopped())
|
||||
++_count;
|
||||
}
|
||||
|
||||
private:
|
||||
Activity<ActiveObject> _activity;
|
||||
int _count;
|
||||
};
|
||||
private:
|
||||
Activity<ActiveObject> _activity;
|
||||
int _count;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
ActivityTest::ActivityTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ActivityTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ActivityTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ActivityTest.h#1 $
|
||||
//
|
||||
// Definition of the ActivityTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define ActivityTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ActivityTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AnyTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Foundation/testsuite/src/AnyTest.cpp#5 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/AnyTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,17 +31,16 @@
|
||||
|
||||
|
||||
#include "AnyTest.h"
|
||||
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Foundation/Any.h"
|
||||
#include "Foundation/Bugcheck.h"
|
||||
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Any.h"
|
||||
#include "Poco/Bugcheck.h"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
using namespace Foundation;
|
||||
|
||||
|
||||
using namespace Poco;
|
||||
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
@@ -107,15 +106,15 @@ void AnyTest::testComplexType()
|
||||
|
||||
void AnyTest::testVector()
|
||||
{
|
||||
vector < int > tmp;
|
||||
std::vector < int > tmp;
|
||||
tmp.push_back( 1 );
|
||||
tmp.push_back( 2 );
|
||||
tmp.push_back( 3 );
|
||||
Any a = tmp;
|
||||
poco_assert (a.type() == typeid(vector < int >) );
|
||||
vector < int > tmp2 = AnyCast < vector < int > >(a);
|
||||
const vector < int >& vecCRef = RefAnyCast < vector < int > >(a);
|
||||
vector < int >& vecRef = RefAnyCast < vector < int > >(a);
|
||||
poco_assert (a.type() == typeid(std::vector < int >) );
|
||||
std::vector < int > tmp2 = AnyCast < std::vector < int > >(a);
|
||||
const std::vector < int >& vecCRef = RefAnyCast < std::vector < int > >(a);
|
||||
std::vector < int >& vecRef = RefAnyCast < std::vector < int > >(a);
|
||||
vecRef[0] = 0;
|
||||
poco_assert( vecRef[0] == vecCRef[0] );
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AnyTest.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/AnyTest.h#1 $
|
||||
//
|
||||
// Tests for Any types
|
||||
//
|
||||
@@ -35,12 +35,9 @@
|
||||
#define AnyTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class AnyTest: public CppUnit::TestCase
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AutoPtrTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoPtrTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/AutoPtrTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,12 +33,12 @@
|
||||
#include "AutoPtrTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/AutoPtr.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Foundation::AutoPtr;
|
||||
using Foundation::NullPointerException;
|
||||
using Poco::AutoPtr;
|
||||
using Poco::NullPointerException;
|
||||
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AutoPtrTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoPtrTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/AutoPtrTest.h#1 $
|
||||
//
|
||||
// Definition of the AutoPtrTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define AutoPtrTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class AutoPtrTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AutoReleasePoolTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoReleasePoolTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/AutoReleasePoolTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,10 +33,10 @@
|
||||
#include "AutoReleasePoolTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/AutoReleasePool.h"
|
||||
#include "Poco/AutoReleasePool.h"
|
||||
|
||||
|
||||
using Foundation::AutoReleasePool;
|
||||
using Poco::AutoReleasePool;
|
||||
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AutoReleasePoolTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/AutoReleasePoolTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/AutoReleasePoolTest.h#1 $
|
||||
//
|
||||
// Definition of the AutoReleasePoolTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define AutoReleasePoolTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class AutoReleasePoolTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Base64Test.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/Base64Test.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/Base64Test.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "Base64Test.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/Base64Encoder.h"
|
||||
#include "Foundation/Base64Decoder.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/Base64Encoder.h"
|
||||
#include "Poco/Base64Decoder.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::Base64Encoder;
|
||||
using Foundation::Base64Decoder;
|
||||
using Foundation::DataFormatException;
|
||||
using Poco::Base64Encoder;
|
||||
using Poco::Base64Decoder;
|
||||
using Poco::DataFormatException;
|
||||
|
||||
|
||||
Base64Test::Base64Test(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Base64Test.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/Base64Test.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/Base64Test.h#1 $
|
||||
//
|
||||
// Definition of the Base64Test class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define Base64Test_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class Base64Test: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// BasicEventTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Foundation/testsuite/src/BasicEventTest.cpp#5 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/BasicEventTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -32,16 +32,16 @@
|
||||
|
||||
#include "BasicEventTest.h"
|
||||
#include "DummyDelegate.h"
|
||||
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Delegate.h"
|
||||
#include "Poco/Expire.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
#include "Foundation/Delegate.h"
|
||||
#include "Foundation/Expire.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Foundation/Exception.h"
|
||||
|
||||
using namespace Foundation;
|
||||
using namespace Poco;
|
||||
|
||||
|
||||
#define LARGEINC 100
|
||||
|
||||
@@ -76,24 +76,24 @@ void BasicEventTest::testNoDelegate()
|
||||
|
||||
//Note: passing &args will not work due to &
|
||||
EventArgs* pArgs = &args;
|
||||
Complex += Delegate < BasicEventTest, Foundation::EventArgs* > (this, &BasicEventTest::onComplex);
|
||||
Complex -= Delegate < BasicEventTest, Foundation::EventArgs* > (this, &BasicEventTest::onComplex);
|
||||
Complex += Delegate < BasicEventTest, Poco::EventArgs* > (this, &BasicEventTest::onComplex);
|
||||
Complex -= Delegate < BasicEventTest, Poco::EventArgs* > (this, &BasicEventTest::onComplex);
|
||||
Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 0 );
|
||||
|
||||
Complex2 += Delegate < BasicEventTest, Foundation::EventArgs > (this, &BasicEventTest::onComplex2);
|
||||
Complex2 -= Delegate < BasicEventTest, Foundation::EventArgs > (this, &BasicEventTest::onComplex2);
|
||||
Complex2 += Delegate < BasicEventTest, Poco::EventArgs > (this, &BasicEventTest::onComplex2);
|
||||
Complex2 -= Delegate < BasicEventTest, Poco::EventArgs > (this, &BasicEventTest::onComplex2);
|
||||
Complex2.notify ( this, args );
|
||||
poco_assert ( _count == 0 );
|
||||
|
||||
const EventArgs* pCArgs = &args;
|
||||
ConstComplex += Delegate < BasicEventTest, const Foundation::EventArgs* > (this, &BasicEventTest::onConstComplex);
|
||||
ConstComplex -= Delegate < BasicEventTest, const Foundation::EventArgs* > (this, &BasicEventTest::onConstComplex);
|
||||
ConstComplex += Delegate < BasicEventTest, const Poco::EventArgs* > (this, &BasicEventTest::onConstComplex);
|
||||
ConstComplex -= Delegate < BasicEventTest, const Poco::EventArgs* > (this, &BasicEventTest::onConstComplex);
|
||||
ConstComplex.notify ( this, pCArgs );
|
||||
poco_assert ( _count == 0 );
|
||||
|
||||
Const2Complex += Delegate < BasicEventTest, const Foundation::EventArgs* const > (this, &BasicEventTest::onConst2Complex);
|
||||
Const2Complex -= Delegate < BasicEventTest, const Foundation::EventArgs* const > (this, &BasicEventTest::onConst2Complex);
|
||||
Const2Complex += Delegate < BasicEventTest, const Poco::EventArgs* const > (this, &BasicEventTest::onConst2Complex);
|
||||
Const2Complex -= Delegate < BasicEventTest, const Poco::EventArgs* const > (this, &BasicEventTest::onConst2Complex);
|
||||
Const2Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 0 );
|
||||
}
|
||||
@@ -114,20 +114,20 @@ void BasicEventTest::testSingleDelegate()
|
||||
poco_assert ( _count == 2 );
|
||||
|
||||
EventArgs* pArgs = &args;
|
||||
Complex += Delegate < BasicEventTest, Foundation::EventArgs* > (this, &BasicEventTest::onComplex);
|
||||
Complex += Delegate < BasicEventTest, Poco::EventArgs* > (this, &BasicEventTest::onComplex);
|
||||
Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 3 );
|
||||
|
||||
Complex2 += Delegate < BasicEventTest, Foundation::EventArgs > (this, &BasicEventTest::onComplex2);
|
||||
Complex2 += Delegate < BasicEventTest, Poco::EventArgs > (this, &BasicEventTest::onComplex2);
|
||||
Complex2.notify ( this, args );
|
||||
poco_assert ( _count == 4 );
|
||||
|
||||
const EventArgs* pCArgs = &args;
|
||||
ConstComplex += Delegate < BasicEventTest, const Foundation::EventArgs* > (this, &BasicEventTest::onConstComplex);
|
||||
ConstComplex += Delegate < BasicEventTest, const Poco::EventArgs* > (this, &BasicEventTest::onConstComplex);
|
||||
ConstComplex.notify ( this, pCArgs );
|
||||
poco_assert ( _count == 5 );
|
||||
|
||||
Const2Complex += Delegate < BasicEventTest, const Foundation::EventArgs* const > (this, &BasicEventTest::onConst2Complex);
|
||||
Const2Complex += Delegate < BasicEventTest, const Poco::EventArgs* const > (this, &BasicEventTest::onConst2Complex);
|
||||
Const2Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 6 );
|
||||
// check if 2nd notify also works
|
||||
@@ -206,7 +206,7 @@ void BasicEventTest::testExpire ()
|
||||
Simple += Expire < int > (Delegate < BasicEventTest, int > (this, &BasicEventTest::onSimple), 500 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 1 );
|
||||
Foundation::Thread::sleep ( 700 );
|
||||
Poco::Thread::sleep ( 700 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 1 );
|
||||
}
|
||||
@@ -220,15 +220,15 @@ void BasicEventTest::testExpireReRegister()
|
||||
Simple += Expire < int > (Delegate < BasicEventTest, int > (this, &BasicEventTest::onSimple), 500 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 1 );
|
||||
Foundation::Thread::sleep ( 200 );
|
||||
Poco::Thread::sleep ( 200 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 2 );
|
||||
// renew registration
|
||||
Simple += Expire < int > (Delegate < BasicEventTest, int > (this, &BasicEventTest::onSimple), 600 );
|
||||
Foundation::Thread::sleep( 400 );
|
||||
Poco::Thread::sleep( 400 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 3 );
|
||||
Foundation::Thread::sleep( 300 );
|
||||
Poco::Thread::sleep( 300 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 3 );
|
||||
}
|
||||
@@ -261,11 +261,11 @@ void BasicEventTest::testOverwriteDelegate ()
|
||||
|
||||
void BasicEventTest::testAsyncNotify ()
|
||||
{
|
||||
Foundation::BasicEvent < int >* pSimple= new Foundation::BasicEvent < int >();
|
||||
Poco::BasicEvent < int >* pSimple= new Poco::BasicEvent < int >();
|
||||
(*pSimple) += Delegate < BasicEventTest, int > (this, &BasicEventTest::onAsync);
|
||||
poco_assert ( _count == 0 );
|
||||
int tmp = 0;
|
||||
Foundation::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp );
|
||||
Poco::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp );
|
||||
delete pSimple; // must work even when the event got deleted!
|
||||
pSimple = NULL;
|
||||
poco_assert ( _count == 0 );
|
||||
@@ -289,29 +289,29 @@ void BasicEventTest::onConstSimple ( const void* pSender, const int& i )
|
||||
_count++;
|
||||
}
|
||||
|
||||
void BasicEventTest::onComplex ( const void* pSender, Foundation::EventArgs* & i )
|
||||
void BasicEventTest::onComplex ( const void* pSender, Poco::EventArgs* & i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void BasicEventTest::onComplex2 ( const void* pSender, Foundation::EventArgs & i )
|
||||
void BasicEventTest::onComplex2 ( const void* pSender, Poco::EventArgs & i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void BasicEventTest::onConstComplex ( const void* pSender, const Foundation::EventArgs*& i )
|
||||
void BasicEventTest::onConstComplex ( const void* pSender, const Poco::EventArgs*& i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void BasicEventTest::onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i )
|
||||
void BasicEventTest::onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void BasicEventTest::onAsync ( const void* pSender, int& i )
|
||||
{
|
||||
Foundation::Thread::sleep ( 700 );
|
||||
Poco::Thread::sleep ( 700 );
|
||||
_count += LARGEINC ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// BasicEventTest.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/BasicEventTest.h#1 $
|
||||
//
|
||||
// Tests for BasicEvent
|
||||
//
|
||||
@@ -31,28 +31,25 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef BasicEventTest_INCLUDED
|
||||
#define BasicEventTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
#include "Poco/BasicEvent.h"
|
||||
#include "Poco/EventArgs.h"
|
||||
|
||||
#include "Foundation/BasicEvent.h"
|
||||
#include "Foundation/EventArgs.h"
|
||||
|
||||
class BasicEventTest: public CppUnit::TestCase
|
||||
{
|
||||
Foundation::BasicEvent<int> Simple;
|
||||
Foundation::BasicEvent<const int> ConstSimple;
|
||||
Foundation::BasicEvent<Foundation::EventArgs*> Complex;
|
||||
Foundation::BasicEvent<Foundation::EventArgs> Complex2;
|
||||
Foundation::BasicEvent<const Foundation::EventArgs*> ConstComplex;
|
||||
Foundation::BasicEvent<const Foundation::EventArgs * const> Const2Complex;
|
||||
Poco::BasicEvent<int> Simple;
|
||||
Poco::BasicEvent<const int> ConstSimple;
|
||||
Poco::BasicEvent<Poco::EventArgs*> Complex;
|
||||
Poco::BasicEvent<Poco::EventArgs> Complex2;
|
||||
Poco::BasicEvent<const Poco::EventArgs*> ConstComplex;
|
||||
Poco::BasicEvent<const Poco::EventArgs * const> Const2Complex;
|
||||
public:
|
||||
BasicEventTest(const std::string& name);
|
||||
~BasicEventTest();
|
||||
@@ -77,10 +74,10 @@ protected:
|
||||
void onSimple ( const void* pSender, int& i );
|
||||
void onSimpleOther ( const void* pSender, int& i );
|
||||
void onConstSimple ( const void* pSender, const int& i );
|
||||
void onComplex ( const void* pSender, Foundation::EventArgs* & i );
|
||||
void onComplex2 ( const void* pSender, Foundation::EventArgs & i );
|
||||
void onConstComplex ( const void* pSender, const Foundation::EventArgs*& i );
|
||||
void onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i );
|
||||
void onComplex ( const void* pSender, Poco::EventArgs* & i );
|
||||
void onComplex2 ( const void* pSender, Poco::EventArgs & i );
|
||||
void onConstComplex ( const void* pSender, const Poco::EventArgs*& i );
|
||||
void onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i );
|
||||
void onAsync ( const void* pSender, int& i );
|
||||
|
||||
int getCount () const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// BinaryReaderWriterTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/BinaryReaderWriterTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/BinaryReaderWriterTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,17 +33,17 @@
|
||||
#include "BinaryReaderWriterTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/BinaryWriter.h"
|
||||
#include "Foundation/BinaryReader.h"
|
||||
#include "Poco/BinaryWriter.h"
|
||||
#include "Poco/BinaryReader.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::BinaryWriter;
|
||||
using Foundation::BinaryReader;
|
||||
using Foundation::Int32;
|
||||
using Foundation::UInt32;
|
||||
using Foundation::Int64;
|
||||
using Foundation::UInt64;
|
||||
using Poco::BinaryWriter;
|
||||
using Poco::BinaryReader;
|
||||
using Poco::Int32;
|
||||
using Poco::UInt32;
|
||||
using Poco::Int64;
|
||||
using Poco::UInt64;
|
||||
|
||||
|
||||
BinaryReaderWriterTest::BinaryReaderWriterTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// BinaryReaderWriterTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/BinaryReaderWriterTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/BinaryReaderWriterTest.h#1 $
|
||||
//
|
||||
// Definition of the BinaryReaderWriterTest class.
|
||||
//
|
||||
@@ -36,18 +36,10 @@
|
||||
#define BinaryReaderWriterTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
#ifndef Foundation_BinaryReader_INCLUDED
|
||||
#include "Foundation/BinaryReader.h"
|
||||
#endif
|
||||
#ifndef Foundation_BinaryWriter_INCLUDED
|
||||
#include "Foundation/BinaryWriter.h"
|
||||
#endif
|
||||
#include "Poco/BinaryReader.h"
|
||||
#include "Poco/BinaryWriter.h"
|
||||
|
||||
|
||||
class BinaryReaderWriterTest: public CppUnit::TestCase
|
||||
@@ -59,8 +51,8 @@ public:
|
||||
void testNative();
|
||||
void testBigEndian();
|
||||
void testLittleEndian();
|
||||
void write(Foundation::BinaryWriter& writer);
|
||||
void read(Foundation::BinaryReader& reader);
|
||||
void write(Poco::BinaryWriter& writer);
|
||||
void read(Poco::BinaryReader& reader);
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ByteOrderTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ByteOrderTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ByteOrderTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,17 +33,17 @@
|
||||
#include "ByteOrderTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/ByteOrder.h"
|
||||
#include "Poco/ByteOrder.h"
|
||||
|
||||
|
||||
using Foundation::ByteOrder;
|
||||
using Foundation::Int16;
|
||||
using Foundation::UInt16;
|
||||
using Foundation::Int32;
|
||||
using Foundation::UInt32;
|
||||
using Poco::ByteOrder;
|
||||
using Poco::Int16;
|
||||
using Poco::UInt16;
|
||||
using Poco::Int32;
|
||||
using Poco::UInt32;
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
using Foundation::Int64;
|
||||
using Foundation::UInt64;
|
||||
using Poco::Int64;
|
||||
using Poco::UInt64;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ByteOrderTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ByteOrderTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ByteOrderTest.h#1 $
|
||||
//
|
||||
// Definition of the ByteOrderTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define ByteOrderTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ByteOrderTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CacheTestSuite.cpp
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CacheTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CacheTestSuite.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CacheTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the CacheTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define CacheTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class CacheTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ChannelTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ChannelTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ChannelTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,26 +33,26 @@
|
||||
#include "ChannelTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/SplitterChannel.h"
|
||||
#include "Foundation/AsyncChannel.h"
|
||||
#include "Foundation/AutoPtr.h"
|
||||
#include "Foundation/Message.h"
|
||||
#include "Foundation/Formatter.h"
|
||||
#include "Foundation/FormattingChannel.h"
|
||||
#include "Foundation/ConsoleChannel.h"
|
||||
#include "Foundation/StreamChannel.h"
|
||||
#include "Poco/SplitterChannel.h"
|
||||
#include "Poco/AsyncChannel.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Message.h"
|
||||
#include "Poco/Formatter.h"
|
||||
#include "Poco/FormattingChannel.h"
|
||||
#include "Poco/ConsoleChannel.h"
|
||||
#include "Poco/StreamChannel.h"
|
||||
#include "TestChannel.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::SplitterChannel;
|
||||
using Foundation::AsyncChannel;
|
||||
using Foundation::FormattingChannel;
|
||||
using Foundation::ConsoleChannel;
|
||||
using Foundation::StreamChannel;
|
||||
using Foundation::Formatter;
|
||||
using Foundation::Message;
|
||||
using Foundation::AutoPtr;
|
||||
using Poco::SplitterChannel;
|
||||
using Poco::AsyncChannel;
|
||||
using Poco::FormattingChannel;
|
||||
using Poco::ConsoleChannel;
|
||||
using Poco::StreamChannel;
|
||||
using Poco::Formatter;
|
||||
using Poco::Message;
|
||||
using Poco::AutoPtr;
|
||||
|
||||
|
||||
class SimpleFormatter: public Formatter
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ChannelTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ChannelTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ChannelTest.h#1 $
|
||||
//
|
||||
// Definition of the ChannelTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define ChannelTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ChannelTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ClassLoaderTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ClassLoaderTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ClassLoaderTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,18 +33,18 @@
|
||||
#include "ClassLoaderTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/ClassLoader.h"
|
||||
#include "Foundation/Manifest.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/ClassLoader.h"
|
||||
#include "Poco/Manifest.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "TestPlugin.h"
|
||||
|
||||
|
||||
using Foundation::ClassLoader;
|
||||
using Foundation::Manifest;
|
||||
using Foundation::SharedLibrary;
|
||||
using Foundation::AbstractMetaObject;
|
||||
using Foundation::NotFoundException;
|
||||
using Foundation::InvalidAccessException;
|
||||
using Poco::ClassLoader;
|
||||
using Poco::Manifest;
|
||||
using Poco::SharedLibrary;
|
||||
using Poco::AbstractMetaObject;
|
||||
using Poco::NotFoundException;
|
||||
using Poco::InvalidAccessException;
|
||||
|
||||
|
||||
ClassLoaderTest::ClassLoaderTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ClassLoaderTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ClassLoaderTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ClassLoaderTest.h#1 $
|
||||
//
|
||||
// Definition of the ClassLoaderTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define ClassLoaderTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ClassLoaderTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CoreTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CoreTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,17 +33,17 @@
|
||||
#include "CoreTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/Bugcheck.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Foundation/Environment.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Poco/Bugcheck.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Environment.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Foundation::Bugcheck;
|
||||
using Foundation::Exception;
|
||||
using Foundation::Environment;
|
||||
using Foundation::Thread;
|
||||
using Poco::Bugcheck;
|
||||
using Poco::Exception;
|
||||
using Poco::Environment;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
//
|
||||
@@ -72,18 +72,18 @@ void CoreTest::testPlatform()
|
||||
|
||||
void CoreTest::testFixedLength()
|
||||
{
|
||||
assert (sizeof(Foundation::Int8) == 1);
|
||||
assert (sizeof(Foundation::UInt8) == 1);
|
||||
assert (sizeof(Foundation::Int16) == 2);
|
||||
assert (sizeof(Foundation::UInt16) == 2);
|
||||
assert (sizeof(Foundation::Int32) == 4);
|
||||
assert (sizeof(Foundation::UInt32) == 4);
|
||||
assert (sizeof(Poco::Int8) == 1);
|
||||
assert (sizeof(Poco::UInt8) == 1);
|
||||
assert (sizeof(Poco::Int16) == 2);
|
||||
assert (sizeof(Poco::UInt16) == 2);
|
||||
assert (sizeof(Poco::Int32) == 4);
|
||||
assert (sizeof(Poco::UInt32) == 4);
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
assert (sizeof(Foundation::Int64) == 8);
|
||||
assert (sizeof(Foundation::UInt64) == 8);
|
||||
assert (sizeof(Poco::Int64) == 8);
|
||||
assert (sizeof(Poco::UInt64) == 8);
|
||||
#endif
|
||||
assert (sizeof(Foundation::IntPtr) == sizeof(void*));
|
||||
assert (sizeof(Foundation::UIntPtr) == sizeof(void*));
|
||||
assert (sizeof(Poco::IntPtr) == sizeof(void*));
|
||||
assert (sizeof(Poco::UIntPtr) == sizeof(void*));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CoreTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CoreTest.h#1 $
|
||||
//
|
||||
// Definition of the CoreTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define CoreTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class CoreTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CoreTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CoreTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -46,6 +46,8 @@
|
||||
#include "DynamicFactoryTest.h"
|
||||
#include "MemoryPoolTest.h"
|
||||
#include "AnyTest.h"
|
||||
#include "HashTest.h"
|
||||
#include "FormatTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* CoreTestSuite::suite()
|
||||
@@ -67,6 +69,8 @@ CppUnit::Test* CoreTestSuite::suite()
|
||||
pSuite->addTest(DynamicFactoryTest::suite());
|
||||
pSuite->addTest(MemoryPoolTest::suite());
|
||||
pSuite->addTest(AnyTest::suite());
|
||||
pSuite->addTest(HashTest::suite());
|
||||
pSuite->addTest(FormatTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CoreTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CoreTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CoreTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the CoreTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define CoreTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class CoreTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CountingStreamTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CountingStreamTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CountingStreamTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,12 +33,12 @@
|
||||
#include "CountingStreamTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/CountingStream.h"
|
||||
#include "Poco/CountingStream.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::CountingInputStream;
|
||||
using Foundation::CountingOutputStream;
|
||||
using Poco::CountingInputStream;
|
||||
using Poco::CountingOutputStream;
|
||||
|
||||
|
||||
CountingStreamTest::CountingStreamTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CountingStreamTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CountingStreamTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CountingStreamTest.h#1 $
|
||||
//
|
||||
// Definition of the CountingStreamTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define CountingStreamTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class CountingStreamTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CryptTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CryptTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CryptTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CryptTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/CryptTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/CryptTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the CryptTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define CryptTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class CryptTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeFormatterTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeFormatterTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeFormatterTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,16 +33,16 @@
|
||||
#include "DateTimeFormatterTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/DateTimeFormatter.h"
|
||||
#include "Foundation/DateTimeFormat.h"
|
||||
#include "Foundation/DateTime.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Poco/DateTimeFormatter.h"
|
||||
#include "Poco/DateTimeFormat.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Timespan.h"
|
||||
|
||||
|
||||
using Foundation::DateTime;
|
||||
using Foundation::Timespan;
|
||||
using Foundation::DateTimeFormat;
|
||||
using Foundation::DateTimeFormatter;
|
||||
using Poco::DateTime;
|
||||
using Poco::Timespan;
|
||||
using Poco::DateTimeFormat;
|
||||
using Poco::DateTimeFormatter;
|
||||
|
||||
|
||||
DateTimeFormatterTest::DateTimeFormatterTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeFormatterTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeFormatterTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeFormatterTest.h#1 $
|
||||
//
|
||||
// Definition of the DateTimeFormatterTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DateTimeFormatterTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DateTimeFormatterTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeParserTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeParserTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeParserTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,18 +33,18 @@
|
||||
#include "DateTimeParserTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/DateTimeParser.h"
|
||||
#include "Foundation/DateTimeFormat.h"
|
||||
#include "Foundation/DateTime.h"
|
||||
#include "Foundation/Timestamp.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/DateTimeParser.h"
|
||||
#include "Poco/DateTimeFormat.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Foundation::DateTime;
|
||||
using Foundation::DateTimeFormat;
|
||||
using Foundation::DateTimeParser;
|
||||
using Foundation::Timestamp;
|
||||
using Foundation::SyntaxException;
|
||||
using Poco::DateTime;
|
||||
using Poco::DateTimeFormat;
|
||||
using Poco::DateTimeParser;
|
||||
using Poco::Timestamp;
|
||||
using Poco::SyntaxException;
|
||||
|
||||
|
||||
DateTimeParserTest::DateTimeParserTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeParserTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeParserTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeParserTest.h#1 $
|
||||
//
|
||||
// Definition of the DateTimeParserTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DateTimeParserTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DateTimeParserTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,14 +33,16 @@
|
||||
#include "DateTimeTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/DateTime.h"
|
||||
#include "Foundation/Timestamp.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Foundation::Timestamp;
|
||||
using Foundation::DateTime;
|
||||
using Foundation::Timespan;
|
||||
using Poco::Timestamp;
|
||||
using Poco::DateTime;
|
||||
using Poco::Timespan;
|
||||
using Poco::AssertionViolationException;
|
||||
|
||||
|
||||
DateTimeTest::DateTimeTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -118,6 +120,18 @@ void DateTimeTest::testJulian()
|
||||
assert (dt.millisecond() == 0);
|
||||
assert (dt.dayOfWeek() == 1);
|
||||
assert (dt.julianDay() == 0);
|
||||
|
||||
// Test that we can represent down to the microsecond.
|
||||
dt = DateTime(2010, 1, 31, 17, 30, 15, 800, 3);
|
||||
|
||||
assert (dt.year() == 2010);
|
||||
assert (dt.month() == 1);
|
||||
assert (dt.day() == 31);
|
||||
assert (dt.hour() == 17);
|
||||
assert (dt.minute() == 30);
|
||||
assert (dt.second() == 15);
|
||||
assert (dt.millisecond() == 800);
|
||||
assert (dt.microsecond() == 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -327,41 +341,245 @@ void DateTimeTest::testAMPM()
|
||||
|
||||
void DateTimeTest::testRelational()
|
||||
{
|
||||
DateTime dt1(2005, 1, 1, 0, 15, 30);
|
||||
DateTime dt2(2005, 1, 2, 0, 15, 30);
|
||||
DateTime dt3(dt1);
|
||||
DateTime dt1(2005, 1, 1, 0, 15, 30);
|
||||
DateTime dt2(2005, 1, 2, 0, 15, 30);
|
||||
DateTime dt3(dt1);
|
||||
|
||||
assert (dt1 < dt2);
|
||||
assert (dt1 <= dt2);
|
||||
assert (dt2 > dt1);
|
||||
assert (dt2 >= dt1);
|
||||
assert (dt1 != dt2);
|
||||
assert (!(dt1 == dt2));
|
||||
assert (dt1 < dt2);
|
||||
assert (dt1 <= dt2);
|
||||
assert (dt2 > dt1);
|
||||
assert (dt2 >= dt1);
|
||||
assert (dt1 != dt2);
|
||||
assert (!(dt1 == dt2));
|
||||
|
||||
assert (dt1 == dt3);
|
||||
assert (!(dt1 != dt3));
|
||||
assert (dt1 >= dt3);
|
||||
assert (dt1 <= dt3);
|
||||
assert (!(dt1 > dt3));
|
||||
assert (!(dt1 < dt3));
|
||||
assert (dt1 == dt3);
|
||||
assert (!(dt1 != dt3));
|
||||
assert (dt1 >= dt3);
|
||||
assert (dt1 <= dt3);
|
||||
assert (!(dt1 > dt3));
|
||||
assert (!(dt1 < dt3));
|
||||
|
||||
static const struct
|
||||
{
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
} values[] =
|
||||
{
|
||||
{ 1, 1, 1 },
|
||||
{ 10, 4, 5 },
|
||||
{ 100, 6, 7 },
|
||||
{ 1000, 8, 9 },
|
||||
{ 2000, 1, 31 },
|
||||
{ 2002, 7, 4 },
|
||||
{ 2002, 12, 31 },
|
||||
{ 2003, 1, 1 },
|
||||
{ 2003, 1, 2 },
|
||||
{ 2003, 8, 5 },
|
||||
{ 2003, 8, 6 },
|
||||
{ 2003, 8, 7 },
|
||||
{ 2004, 9, 3 },
|
||||
{ 2004, 9, 4 },
|
||||
};
|
||||
|
||||
const int num_values = sizeof values / sizeof *values;
|
||||
for (int i = 0; i < num_values; ++i)
|
||||
{
|
||||
DateTime v;
|
||||
const DateTime& V = v;
|
||||
v.assign(values[i].year, values[i].month, values[i].day);
|
||||
for (int j = 0; j < num_values; ++j)
|
||||
{
|
||||
DateTime u;
|
||||
const DateTime& U = u;
|
||||
u.assign(values[j].year, values[j].month, values[j].day);
|
||||
|
||||
loop_2_assert(i, j, j < i == U < V);
|
||||
loop_2_assert(i, j, j <= i == U <= V);
|
||||
loop_2_assert(i, j, j >= i == U >= V);
|
||||
loop_2_assert(i, j, j > i == U > V);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DateTimeTest::testArithmetics()
|
||||
{
|
||||
DateTime dt1(2005, 1, 1, 0, 15, 30);
|
||||
DateTime dt2(2005, 1, 2, 0, 15, 30);
|
||||
DateTime dt1(2005, 1, 1, 0, 15, 30);
|
||||
DateTime dt2(2005, 1, 2, 0, 15, 30);
|
||||
|
||||
Timespan s = dt2 - dt1;
|
||||
assert (s.days() == 1);
|
||||
Timespan s = dt2 - dt1;
|
||||
assert (s.days() == 1);
|
||||
|
||||
DateTime dt3 = dt1 + s;
|
||||
assert (dt3 == dt2);
|
||||
DateTime dt3 = dt1 + s;
|
||||
assert (dt3 == dt2);
|
||||
|
||||
dt3 -= s;
|
||||
assert (dt3 == dt1);
|
||||
dt1 += s;
|
||||
assert (dt1 == dt2);
|
||||
dt3 -= s;
|
||||
assert (dt3 == dt1);
|
||||
dt1 += s;
|
||||
assert (dt1 == dt2);
|
||||
|
||||
static const struct
|
||||
{
|
||||
int lineNum; // source line number
|
||||
int year1; // operand/result date1 year
|
||||
int month1; // operand/result date1 month
|
||||
unsigned int day1; // operand/result date1 day
|
||||
int numDays; // operand/result 'int' number of days
|
||||
int year2; // operand/result date2 year
|
||||
int month2; // operand/result date2 month
|
||||
unsigned int day2; // operand/result date2 day
|
||||
} data[] =
|
||||
{
|
||||
// - - - -first- - - - - - - second - - -
|
||||
//line no. year month day numDays year month day
|
||||
//------- ----- ----- ----- ------- ----- ----- -----
|
||||
{ __LINE__, 1, 1, 1, 1, 1, 1, 2 },
|
||||
{ __LINE__, 10, 2, 28, 1, 10, 3, 1 },
|
||||
{ __LINE__, 100, 3, 31, 2, 100, 4, 2 },
|
||||
{ __LINE__, 1000, 4, 30, 4, 1000, 5, 4 },
|
||||
{ __LINE__, 1000, 6, 1, -31, 1000, 5, 1 },
|
||||
{ __LINE__, 1001, 1, 1, -365, 1000, 1, 1 },
|
||||
{ __LINE__, 1100, 5, 31, 30, 1100, 6, 30 },
|
||||
{ __LINE__, 1200, 6, 30, 32, 1200, 8, 1 },
|
||||
{ __LINE__, 1996, 2, 28, 367, 1997, 3, 1 },
|
||||
{ __LINE__, 1997, 2, 28, 366, 1998, 3, 1 },
|
||||
{ __LINE__, 1998, 2, 28, 365, 1999, 2, 28 },
|
||||
{ __LINE__, 1999, 2, 28, 364, 2000, 2, 27 },
|
||||
{ __LINE__, 1999, 2, 28, 1096, 2002, 2, 28 },
|
||||
{ __LINE__, 2002, 2, 28, -1096, 1999, 2, 28 },
|
||||
};
|
||||
|
||||
const int num_data = sizeof data / sizeof *data;
|
||||
for (int di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].lineNum;
|
||||
const int num_days = data[di].numDays;
|
||||
DateTime x = DateTime(data[di].year1, data[di].month1, data[di].day1);
|
||||
const DateTime& X = x;
|
||||
x += Timespan(num_days, 0, 0, 0, 0);
|
||||
loop_1_assert(line, data[di].year2 == X.year());
|
||||
loop_1_assert(line, data[di].month2 == X.month());
|
||||
loop_1_assert(line, data[di].day2 == X.day());
|
||||
}
|
||||
}
|
||||
|
||||
void DateTimeTest::testIncrementDecrement()
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
int lineNum; // source line number
|
||||
int year1; // (first) date year
|
||||
int month1; // (first) date month
|
||||
unsigned int day1; // (first) date day
|
||||
int year2; // (second) date year
|
||||
int month2; // (second) date month
|
||||
unsigned int day2; // (second) date day
|
||||
} data[] =
|
||||
{
|
||||
// - - - -first- - - - - - - second - - -
|
||||
//line no. year month day year month day
|
||||
//------- ----- ----- ----- ----- ----- -----
|
||||
{ __LINE__, 1, 1, 1, 1, 1, 2 },
|
||||
{ __LINE__, 10, 2, 28, 10, 3, 1 },
|
||||
{ __LINE__, 100, 3, 31, 100, 4, 1 },
|
||||
{ __LINE__, 1000, 4, 30, 1000, 5, 1 },
|
||||
{ __LINE__, 1100, 5, 31, 1100, 6, 1 },
|
||||
{ __LINE__, 1200, 6, 30, 1200, 7, 1 },
|
||||
{ __LINE__, 1300, 7, 31, 1300, 8, 1 },
|
||||
{ __LINE__, 1400, 8, 31, 1400, 9, 1 },
|
||||
{ __LINE__, 1500, 9, 30, 1500, 10, 1 },
|
||||
{ __LINE__, 1600, 10, 31, 1600, 11, 1 },
|
||||
{ __LINE__, 1700, 11, 30, 1700, 12, 1 },
|
||||
{ __LINE__, 1800, 12, 31, 1801, 1, 1 },
|
||||
{ __LINE__, 1996, 2, 28, 1996, 2, 29 },
|
||||
{ __LINE__, 1997, 2, 28, 1997, 3, 1 },
|
||||
{ __LINE__, 1998, 2, 28, 1998, 3, 1 },
|
||||
{ __LINE__, 1999, 2, 28, 1999, 3, 1 },
|
||||
{ __LINE__, 2000, 2, 28, 2000, 2, 29 },
|
||||
{ __LINE__, 2001, 2, 28, 2001, 3, 1 },
|
||||
{ __LINE__, 2004, 2, 28, 2004, 2, 29 },
|
||||
{ __LINE__, 2100, 2, 28, 2100, 3, 1 },
|
||||
{ __LINE__, 2400, 2, 28, 2400, 2, 29 },
|
||||
};
|
||||
|
||||
const int num_data = sizeof data / sizeof *data;
|
||||
int di;
|
||||
|
||||
for (di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].lineNum;
|
||||
DateTime x = DateTime(data[di].year1, data[di].month1,
|
||||
data[di].day1);
|
||||
// Would do pre-increment of x here.
|
||||
const DateTime& X = x;
|
||||
x = x + Timespan(1,0,0,0,0);
|
||||
DateTime y = x; const DateTime& Y = y;
|
||||
|
||||
loop_1_assert(line, data[di].year2 == X.year());
|
||||
loop_1_assert(line, data[di].month2 == X.month());
|
||||
loop_1_assert(line, data[di].day2 == X.day());
|
||||
|
||||
loop_1_assert(line, data[di].year2 == Y.year());
|
||||
loop_1_assert(line, data[di].month2 == Y.month());
|
||||
loop_1_assert(line, data[di].day2 == Y.day());
|
||||
}
|
||||
|
||||
for (di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].lineNum;
|
||||
DateTime x = DateTime(data[di].year1, data[di].month1, data[di].day1);
|
||||
DateTime x1 = DateTime(data[di].year1, data[di].month1, data[di].day1);
|
||||
DateTime x2 = DateTime(data[di].year2, data[di].month2, data[di].day2);
|
||||
DateTime y = x; const DateTime& Y = y;
|
||||
|
||||
// Would do post increment of x here.
|
||||
const DateTime& X = x;
|
||||
x = x + Timespan(1,0,0,0,0);
|
||||
|
||||
loop_1_assert(line, data[di].year2 == X.year());
|
||||
loop_1_assert(line, data[di].month2 == X.month());
|
||||
loop_1_assert(line, data[di].day2 == X.day());
|
||||
loop_1_assert(line, data[di].year1 == Y.year());
|
||||
loop_1_assert(line, data[di].month1 == Y.month());
|
||||
loop_1_assert(line, data[di].day1 == Y.day());
|
||||
}
|
||||
|
||||
for (di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].lineNum;
|
||||
DateTime x = DateTime(data[di].year2, data[di].month2, data[di].day2);
|
||||
const DateTime& X = x;
|
||||
x = x - Timespan(1,0,0,0,0);
|
||||
DateTime y = x; DateTime Y = y;
|
||||
|
||||
loop_1_assert(line, data[di].year1 == X.year());
|
||||
loop_1_assert(line, data[di].month1 == X.month());
|
||||
loop_1_assert(line, data[di].day1 == X.day());
|
||||
|
||||
loop_1_assert(line, data[di].year1 == Y.year());
|
||||
loop_1_assert(line, data[di].month1 == Y.month());
|
||||
loop_1_assert(line, data[di].day1 == Y.day());
|
||||
}
|
||||
|
||||
for (di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].lineNum;
|
||||
DateTime x1 = DateTime(data[di].year1, data[di].month1, data[di].day1);
|
||||
DateTime x = DateTime(data[di].year2, data[di].month2, data[di].day2);
|
||||
DateTime y = x; DateTime Y = y;
|
||||
const DateTime& X = x;
|
||||
// would post-decrement x here.
|
||||
x = x - Timespan(1,0,0,0,0);
|
||||
|
||||
loop_1_assert(line, data[di].year1 == X.year());
|
||||
loop_1_assert(line, data[di].month1 == X.month());
|
||||
loop_1_assert(line, data[di].day1 == X.day());
|
||||
|
||||
loop_1_assert(line, data[di].year2 == Y.year());
|
||||
loop_1_assert(line, data[di].month2 == Y.month());
|
||||
loop_1_assert(line, data[di].day2 == Y.day());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -378,6 +596,243 @@ void DateTimeTest::testSwap()
|
||||
}
|
||||
|
||||
|
||||
void DateTimeTest::testUsage()
|
||||
{
|
||||
DateTime dt1(1776, 7, 4);
|
||||
assert(dt1.year() == 1776);
|
||||
assert(dt1.month() == 7);
|
||||
assert(dt1.day() == 4);
|
||||
|
||||
DateTime dt2(dt1);
|
||||
dt2 += Timespan(6, 0, 0, 0, 0);
|
||||
assert(dt2.year() == 1776);
|
||||
assert(dt2.month() == 7);
|
||||
assert(dt2.day() == 10);
|
||||
|
||||
Timespan span = dt2 - dt1;
|
||||
assert(span.days() == 6);
|
||||
|
||||
// TODO - When adding months and years we need to be
|
||||
// able to specify the end-end convention.
|
||||
// We cannot do this in POCO at the moment.
|
||||
}
|
||||
|
||||
|
||||
void DateTimeTest::testSetYearDay()
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
int d_lineNum; // source line number
|
||||
int d_year; // year under test
|
||||
unsigned int d_day; // day-of-year under test
|
||||
int d_expMonth; // expected month
|
||||
unsigned int d_expDay; // expected day
|
||||
} data[] =
|
||||
{
|
||||
//line no. year dayOfYr exp. month exp. day
|
||||
//------- ----- ------- ---------- --------
|
||||
{ __LINE__, 1, 1, 1, 1 },
|
||||
{ __LINE__, 1, 2, 1, 2 },
|
||||
{ __LINE__, 1, 365, 12, 31 },
|
||||
{ __LINE__, 1996, 1, 1, 1 },
|
||||
{ __LINE__, 1996, 2, 1, 2 },
|
||||
{ __LINE__, 1996, 365, 12, 30 },
|
||||
{ __LINE__, 1996, 366, 12, 31 }
|
||||
};
|
||||
|
||||
const int num_data = sizeof data / sizeof *data;
|
||||
for (int di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].d_lineNum;
|
||||
const int year = data[di].d_year;
|
||||
const unsigned int day = data[di].d_day;
|
||||
|
||||
const int exp_month = data[di].d_expMonth;
|
||||
const unsigned int exp_day = data[di].d_expDay;
|
||||
const DateTime r(year, exp_month, exp_day);
|
||||
DateTime x;
|
||||
const DateTime& X = x;
|
||||
|
||||
#if 0
|
||||
// TODO - need to be able to assign a day number in the year
|
||||
// but POCO is not able to do this.
|
||||
|
||||
x.assign(year, day);
|
||||
|
||||
// TODO - need to be able to assert with the loop counter
|
||||
// but cppUnit is not able to do this.
|
||||
|
||||
assert(r == x);
|
||||
assert(day == X.dayOfYear());
|
||||
#endif
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
int d_lineNum; // source line number
|
||||
int d_year; // year under test
|
||||
int d_day; // day-of-year under test
|
||||
int d_exp; // expected status
|
||||
} data2[] =
|
||||
{
|
||||
//line no. year dayOfYr expected value
|
||||
//------- ----- ------- --------------
|
||||
{ __LINE__, 1, 1, 1 },
|
||||
{ __LINE__, 1, -1, 0 },
|
||||
{ __LINE__, 1, 0, 0 },
|
||||
{ __LINE__, 1, 365, 1 },
|
||||
{ __LINE__, 1, 366, 0 },
|
||||
{ __LINE__, 1, 367, 0 },
|
||||
{ __LINE__, 0, 0, 0 },
|
||||
{ __LINE__, -1, -1, 0 },
|
||||
{ __LINE__, 1996, 1, 1 },
|
||||
{ __LINE__, 1996, 2, 1 },
|
||||
{ __LINE__, 1996, 32, 1 },
|
||||
{ __LINE__, 1996, 365, 1 },
|
||||
{ __LINE__, 1996, 366, 1 },
|
||||
{ __LINE__, 1996, 367, 0 },
|
||||
};
|
||||
|
||||
const int num_data2 = sizeof data2 / sizeof *data2;
|
||||
for (int di = 0; di < num_data2; ++di)
|
||||
{
|
||||
const int line = data2[di].d_lineNum;
|
||||
const int year = data2[di].d_year;
|
||||
const int day = data2[di].d_day;
|
||||
const int exp = data2[di].d_exp;
|
||||
DateTime x;
|
||||
const DateTime& X = x;
|
||||
if (1 == exp)
|
||||
{
|
||||
DateTime r;
|
||||
const DateTime& r2 = r;
|
||||
#if 0
|
||||
r.set(year, day);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DateTimeTest::testIsValid()
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
int d_lineNum; // source line number
|
||||
int d_year; // year under test
|
||||
int d_month; // month under test
|
||||
int d_day; // day under test
|
||||
bool d_exp; // expected value
|
||||
} data[] =
|
||||
{
|
||||
//line no. year month day expected value
|
||||
//------- ----- ----- ----- --------------
|
||||
{ __LINE__, 0, 0, 0, false },
|
||||
{ __LINE__, 1, 1, 0, false },
|
||||
{ __LINE__, 1, 0, 1, false },
|
||||
{ __LINE__, 0, 1, 1, true },
|
||||
{ __LINE__, 1, 1, -1, false },
|
||||
{ __LINE__, 1, -1, 1, false },
|
||||
{ __LINE__, 2004, 1, 32, false },
|
||||
{ __LINE__, 2004, 2, 30, false },
|
||||
{ __LINE__, 2004, 3, 32, false },
|
||||
{ __LINE__, 2004, 4, 31, false },
|
||||
{ __LINE__, 2004, 5, 32, false },
|
||||
{ __LINE__, 2004, 6, 31, false },
|
||||
{ __LINE__, 2004, 7, 32, false },
|
||||
{ __LINE__, 2004, 8, 32, false },
|
||||
{ __LINE__, 2004, 9, 31, false },
|
||||
{ __LINE__, 2004, 10, 32, false },
|
||||
{ __LINE__, 2004, 11, 31, false },
|
||||
{ __LINE__, 2004, 12, 32, false },
|
||||
{ __LINE__, 0, 12, 31, true },
|
||||
{ __LINE__, 0, 2, 29, true },
|
||||
{ __LINE__, 1, 1, 1, true },
|
||||
{ __LINE__, 2010, 1, 2, true },
|
||||
{ __LINE__, 2011, 2, 5, true },
|
||||
{ __LINE__, 2012, 3, 10, true },
|
||||
{ __LINE__, 2013, 4, 17, true },
|
||||
{ __LINE__, 2014, 5, 23, true },
|
||||
{ __LINE__, 1600, 2, 29, true },
|
||||
{ __LINE__, 1700, 2, 29, false },
|
||||
{ __LINE__, 1800, 2, 29, false },
|
||||
{ __LINE__, 1900, 2, 29, false },
|
||||
{ __LINE__, 2000, 2, 29, true },
|
||||
{ __LINE__, 2100, 2, 29, false },
|
||||
};
|
||||
|
||||
const int num_data = sizeof data / sizeof *data;
|
||||
for (int di = 0; di < num_data; ++di)
|
||||
{
|
||||
const int line = data[di].d_lineNum;
|
||||
const int year = data[di].d_year;
|
||||
const int month = data[di].d_month;
|
||||
const int day = data[di].d_day;
|
||||
const bool exp = data[di].d_exp;
|
||||
|
||||
bool isValid = DateTime::isValid(year, month, day);
|
||||
loop_1_assert(line, exp == isValid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DateTimeTest::testDayOfWeek()
|
||||
{
|
||||
typedef DateTime::DaysOfWeek DOW;
|
||||
|
||||
static const struct
|
||||
{
|
||||
int d_lineNum; // source line number
|
||||
int d_year; // year under test
|
||||
int d_month; // month under test
|
||||
int d_day; // day under test
|
||||
DOW d_expDay; // number of days to be added
|
||||
} data[] =
|
||||
{
|
||||
//Line no. year month day expDay
|
||||
//------- ----- ----- ----- -------
|
||||
{ __LINE__, 1600, 1, 1, DateTime::SATURDAY },
|
||||
{ __LINE__, 1600, 1, 2, DateTime::SUNDAY },
|
||||
{ __LINE__, 1600, 1, 3, DateTime::MONDAY },
|
||||
{ __LINE__, 1600, 1, 4, DateTime::TUESDAY },
|
||||
{ __LINE__, 1600, 1, 5, DateTime::WEDNESDAY },
|
||||
{ __LINE__, 1600, 1, 6, DateTime::THURSDAY },
|
||||
{ __LINE__, 1600, 1, 7, DateTime::FRIDAY },
|
||||
{ __LINE__, 1600, 1, 8, DateTime::SATURDAY },
|
||||
{ __LINE__, 1752, 8, 27, DateTime::SUNDAY },
|
||||
{ __LINE__, 1752, 8, 28, DateTime::MONDAY },
|
||||
{ __LINE__, 1752, 8, 29, DateTime::TUESDAY },
|
||||
{ __LINE__, 1752, 8, 30, DateTime::WEDNESDAY },
|
||||
{ __LINE__, 1752, 8, 31, DateTime::THURSDAY },
|
||||
{ __LINE__, 1752, 9, 1, DateTime::FRIDAY },
|
||||
{ __LINE__, 1752, 9, 2, DateTime::SATURDAY },
|
||||
{ __LINE__, 1752, 9, 14, DateTime::THURSDAY },
|
||||
{ __LINE__, 1752, 9, 15, DateTime::FRIDAY },
|
||||
{ __LINE__, 1752, 9, 16, DateTime::SATURDAY },
|
||||
{ __LINE__, 1752, 9, 17, DateTime::SUNDAY },
|
||||
{ __LINE__, 1752, 9, 18, DateTime::MONDAY },
|
||||
{ __LINE__, 1752, 9, 19, DateTime::TUESDAY },
|
||||
{ __LINE__, 1999, 12, 28, DateTime::TUESDAY },
|
||||
{ __LINE__, 1999, 12, 29, DateTime::WEDNESDAY },
|
||||
{ __LINE__, 1999, 12, 30, DateTime::THURSDAY },
|
||||
{ __LINE__, 1999, 12, 31, DateTime::FRIDAY },
|
||||
{ __LINE__, 2000, 1, 1, DateTime::SATURDAY },
|
||||
{ __LINE__, 2000, 1, 2, DateTime::SUNDAY },
|
||||
{ __LINE__, 2000, 1, 3, DateTime::MONDAY },
|
||||
{ __LINE__, 2000, 1, 4, DateTime::TUESDAY },
|
||||
};
|
||||
|
||||
const int num_data = sizeof data / sizeof *data;
|
||||
for (int di = 0; di < num_data ; ++di)
|
||||
{
|
||||
const int line = data[di].d_lineNum;
|
||||
DateTime x = DateTime(data[di].d_year, data[di].d_month, data[di].d_day);
|
||||
const DateTime& X = x;
|
||||
loop_1_assert(line, data[di].d_expDay == X.dayOfWeek());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DateTimeTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -403,5 +858,11 @@ CppUnit::Test* DateTimeTest::suite()
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testArithmetics);
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testSwap);
|
||||
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testUsage);
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testSetYearDay);
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testIsValid);
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testDayOfWeek);
|
||||
CppUnit_addTest(pSuite, DateTimeTest, testIncrementDecrement);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTest.h#1 $
|
||||
//
|
||||
// Definition of the DateTimeTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DateTimeTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DateTimeTest: public CppUnit::TestCase
|
||||
@@ -60,6 +56,11 @@ public:
|
||||
void testRelational();
|
||||
void testArithmetics();
|
||||
void testSwap();
|
||||
void testUsage();
|
||||
void testSetYearDay();
|
||||
void testIsValid();
|
||||
void testDayOfWeek();
|
||||
void testIncrementDecrement();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DateTimeTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DateTimeTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DateTimeTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the DateTimeTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define DateTimeTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DateTimeTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DigestStreamTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DigestStreamTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DigestStreamTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "DigestStreamTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/DigestStream.h"
|
||||
#include "Foundation/MD5Engine.h"
|
||||
#include "Poco/DigestStream.h"
|
||||
#include "Poco/MD5Engine.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::DigestInputStream;
|
||||
using Foundation::DigestOutputStream;
|
||||
using Foundation::DigestEngine;
|
||||
using Foundation::MD5Engine;
|
||||
using Poco::DigestInputStream;
|
||||
using Poco::DigestOutputStream;
|
||||
using Poco::DigestEngine;
|
||||
using Poco::MD5Engine;
|
||||
|
||||
|
||||
DigestStreamTest::DigestStreamTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DigestStreamTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DigestStreamTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DigestStreamTest.h#1 $
|
||||
//
|
||||
// Definition of the DigestStreamTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DigestStreamTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DigestStreamTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Driver.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/Driver.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/Driver.cpp#1 $
|
||||
//
|
||||
// Console-based test driver.
|
||||
//
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DummyDelegate.cpp
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DummyDelegate.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
#include "DummyDelegate.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
DummyDelegate::DummyDelegate () {}
|
||||
DummyDelegate::~DummyDelegate () {}
|
||||
@@ -40,7 +40,7 @@ void DummyDelegate::onSimple ( const void* pSender, int& i )
|
||||
{
|
||||
if ( i != 0)
|
||||
{
|
||||
throw Foundation::InvalidArgumentException();
|
||||
throw Poco::InvalidArgumentException();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ void DummyDelegate::onSimple2 ( const void* pSender, int& i )
|
||||
{
|
||||
if ( i != 1)
|
||||
{
|
||||
throw Foundation::InvalidArgumentException();
|
||||
throw Poco::InvalidArgumentException();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,50 @@
|
||||
//
|
||||
// DummyDelegate.h
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DummyDelegate.h#1 $
|
||||
//
|
||||
// Definition of DummyDelegate class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef DummyDelegate_INCLUDED
|
||||
#define DummyDelegate_INCLUDED
|
||||
|
||||
|
||||
class DummyDelegate
|
||||
{
|
||||
public:
|
||||
DummyDelegate ();
|
||||
virtual ~DummyDelegate ();
|
||||
DummyDelegate();
|
||||
virtual ~DummyDelegate();
|
||||
|
||||
void onSimple ( const void* pSender, int& i );
|
||||
void onSimple2 ( const void* pSender, int& i );
|
||||
void onSimple(const void* pSender, int& i);
|
||||
void onSimple2(const void* pSender, int& i);
|
||||
};
|
||||
|
||||
|
||||
#endif // DummyDelegate_INCLUDED
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DynamicFactoryTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DynamicFactoryTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DynamicFactoryTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,13 +33,13 @@
|
||||
#include "DynamicFactoryTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/DynamicFactory.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/DynamicFactory.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
using Foundation::DynamicFactory;
|
||||
using Foundation::Instantiator;
|
||||
using Poco::DynamicFactory;
|
||||
using Poco::Instantiator;
|
||||
|
||||
|
||||
namespace
|
||||
@@ -99,7 +99,7 @@ void DynamicFactoryTest::testDynamicFactory()
|
||||
dynFactory.registerClass<A>("A");
|
||||
fail("already registered - must throw");
|
||||
}
|
||||
catch (Foundation::ExistsException&)
|
||||
catch (Poco::ExistsException&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void DynamicFactoryTest::testDynamicFactory()
|
||||
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
|
||||
fail("unregistered - must throw");
|
||||
}
|
||||
catch (Foundation::NotFoundException&)
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DynamicFactoryTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/DynamicFactoryTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/DynamicFactoryTest.h#1 $
|
||||
//
|
||||
// Definition of the DynamicFactoryTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DynamicFactoryTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DynamicFactoryTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// EventTestSuite.cpp
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/EventTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// EventTestSuite.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/EventTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the EventTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define EventTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class EventTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ExpireCacheTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Foundation/testsuite/src/ExpireCacheTest.cpp#5 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ExpireCacheTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,20 +31,22 @@
|
||||
|
||||
|
||||
#include "ExpireCacheTest.h"
|
||||
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/ExpireCache.h"
|
||||
#include "Poco/Bugcheck.h"
|
||||
#include "Poco/Thread.h"
|
||||
|
||||
|
||||
using namespace Poco;
|
||||
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Foundation/ExpireCache.h"
|
||||
#include "Foundation/Bugcheck.h"
|
||||
#include "Foundation/Thread.h"
|
||||
using namespace Foundation;
|
||||
|
||||
#define DURSLEEP 250
|
||||
#define DURHALFSLEEP DURSLEEP / 2
|
||||
#define DURWAIT 300
|
||||
|
||||
|
||||
ExpireCacheTest::ExpireCacheTest(const std::string& name ): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
@@ -71,20 +73,17 @@ void ExpireCacheTest::testClear()
|
||||
poco_assert ( !aCache.has( 1 ) );
|
||||
poco_assert ( !aCache.has( 3 ) );
|
||||
poco_assert ( !aCache.has( 5 ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ExpireCacheTest::testExpire0()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
ExpireCache < int, int > aCache( 24 );
|
||||
failmsg ( "cache expire lower than 25 is illegal, test should fail");
|
||||
}
|
||||
catch ( Foundation::InvalidArgumentException& )
|
||||
catch ( Poco::InvalidArgumentException& )
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -142,6 +141,18 @@ void ExpireCacheTest::testExpireN()
|
||||
}
|
||||
|
||||
|
||||
void ExpireCacheTest::testDuplicateAdd()
|
||||
{
|
||||
ExpireCache < int, int > aCache( DURSLEEP );
|
||||
aCache.add(1, 2); // 1
|
||||
poco_assert (aCache.has(1));
|
||||
poco_assert (*aCache.get(1) == 2);
|
||||
aCache.add(1, 3);
|
||||
poco_assert (aCache.has(1));
|
||||
poco_assert (*aCache.get(1) == 3);
|
||||
}
|
||||
|
||||
|
||||
void ExpireCacheTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -159,6 +170,7 @@ CppUnit::Test* ExpireCacheTest::suite()
|
||||
CppUnit_addTest(pSuite, ExpireCacheTest, testClear);
|
||||
CppUnit_addTest(pSuite, ExpireCacheTest, testExpire0);
|
||||
CppUnit_addTest(pSuite, ExpireCacheTest, testExpireN);
|
||||
CppUnit_addTest(pSuite, ExpireCacheTest, testDuplicateAdd);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ExpireCacheTest.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ExpireCacheTest.h#1 $
|
||||
//
|
||||
// Tests for ExpireCache
|
||||
//
|
||||
@@ -35,12 +35,9 @@
|
||||
#define ExpireCacheTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ExpireCacheTest: public CppUnit::TestCase
|
||||
{
|
||||
@@ -49,6 +46,7 @@ public:
|
||||
~ExpireCacheTest();
|
||||
|
||||
void testClear();
|
||||
void testDuplicateAdd();
|
||||
void testExpire0();
|
||||
void testExpireN();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ExpireLRUCacheTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Foundation/testsuite/src/ExpireLRUCacheTest.cpp#5 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ExpireLRUCacheTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,20 +31,22 @@
|
||||
|
||||
|
||||
#include "ExpireLRUCacheTest.h"
|
||||
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/ExpireLRUCache.h"
|
||||
#include "Poco/Bugcheck.h"
|
||||
#include "Poco/Thread.h"
|
||||
|
||||
|
||||
using namespace Poco;
|
||||
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Foundation/ExpireLRUCache.h"
|
||||
#include "Foundation/Bugcheck.h"
|
||||
#include "Foundation/Thread.h"
|
||||
using namespace Foundation;
|
||||
|
||||
#define DURSLEEP 250
|
||||
#define DURHALFSLEEP DURSLEEP / 2
|
||||
#define DURWAIT 300
|
||||
|
||||
|
||||
ExpireLRUCacheTest::ExpireLRUCacheTest(const std::string& name ): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
@@ -71,20 +73,17 @@ void ExpireLRUCacheTest::testClear()
|
||||
poco_assert ( !aCache.has( 1 ) );
|
||||
poco_assert ( !aCache.has( 3 ) );
|
||||
poco_assert ( !aCache.has( 5 ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ExpireLRUCacheTest::testExpire0()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
ExpireLRUCache < int, int > aCache( 1024, 24 );
|
||||
failmsg ( "cache expire lower than 25 is illegal, test should fail");
|
||||
}
|
||||
catch (Foundation::InvalidArgumentException&)
|
||||
catch (Poco::InvalidArgumentException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -150,7 +149,7 @@ void ExpireLRUCacheTest::testCacheSize0()
|
||||
ExpireLRUCache < int, int > aCache( 0 );
|
||||
failmsg ("cache size of 0 is illegal, test should fail");
|
||||
}
|
||||
catch (Foundation::InvalidArgumentException&)
|
||||
catch (Poco::InvalidArgumentException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -179,8 +178,6 @@ void ExpireLRUCacheTest::testCacheSize1()
|
||||
|
||||
// removing illegal entries should work too
|
||||
aCache.remove(666);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -274,6 +271,19 @@ void ExpireLRUCacheTest::testCacheSizeN()
|
||||
poco_assert ( !aCache.has( 3 ) );
|
||||
}
|
||||
|
||||
|
||||
void ExpireLRUCacheTest::testDuplicateAdd()
|
||||
{
|
||||
ExpireLRUCache < int, int > aCache( 3 );
|
||||
aCache.add(1, 2); // 1
|
||||
poco_assert (aCache.has(1));
|
||||
poco_assert (*aCache.get(1) == 2);
|
||||
aCache.add(1, 3);
|
||||
poco_assert (aCache.has(1));
|
||||
poco_assert (*aCache.get(1) == 3);
|
||||
}
|
||||
|
||||
|
||||
void ExpireLRUCacheTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -295,6 +305,7 @@ CppUnit::Test* ExpireLRUCacheTest::suite()
|
||||
CppUnit_addTest(pSuite, ExpireLRUCacheTest, testCacheSize1);
|
||||
CppUnit_addTest(pSuite, ExpireLRUCacheTest, testCacheSize2);
|
||||
CppUnit_addTest(pSuite, ExpireLRUCacheTest, testCacheSizeN);
|
||||
CppUnit_addTest(pSuite, ExpireLRUCacheTest, testDuplicateAdd);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ExpireLRUCacheTest.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ExpireLRUCacheTest.h#1 $
|
||||
//
|
||||
// Tests for ExpireLRUCache
|
||||
//
|
||||
@@ -35,12 +35,9 @@
|
||||
#define ExpireLRUCacheTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ExpireLRUCacheTest: public CppUnit::TestCase
|
||||
{
|
||||
@@ -55,6 +52,7 @@ public:
|
||||
void testCacheSize1();
|
||||
void testCacheSize2();
|
||||
void testCacheSizeN();
|
||||
void testDuplicateAdd();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FIFOEventTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Foundation/testsuite/src/FIFOEventTest.cpp#5 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FIFOEventTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,16 +34,18 @@
|
||||
#include "DummyDelegate.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Delegate.h"
|
||||
#include "Poco/Expire.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
#include "Foundation/Delegate.h"
|
||||
#include "Foundation/Expire.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Foundation/Exception.h"
|
||||
|
||||
using namespace Foundation;
|
||||
using namespace Poco;
|
||||
|
||||
|
||||
#define LARGEINC 100
|
||||
|
||||
|
||||
FIFOEventTest::FIFOEventTest(const std::string& name ): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
@@ -74,24 +76,24 @@ void FIFOEventTest::testNoDelegate()
|
||||
|
||||
//Note: passing &args will not work due to &
|
||||
EventArgs* pArgs = &args;
|
||||
Complex += Delegate < FIFOEventTest, Foundation::EventArgs* > (this, &FIFOEventTest::onComplex);
|
||||
Complex -= Delegate < FIFOEventTest, Foundation::EventArgs* > (this, &FIFOEventTest::onComplex);
|
||||
Complex += Delegate < FIFOEventTest, Poco::EventArgs* > (this, &FIFOEventTest::onComplex);
|
||||
Complex -= Delegate < FIFOEventTest, Poco::EventArgs* > (this, &FIFOEventTest::onComplex);
|
||||
Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 0 );
|
||||
|
||||
Complex2 += Delegate < FIFOEventTest, Foundation::EventArgs > (this, &FIFOEventTest::onComplex2);
|
||||
Complex2 -= Delegate < FIFOEventTest, Foundation::EventArgs > (this, &FIFOEventTest::onComplex2);
|
||||
Complex2 += Delegate < FIFOEventTest, Poco::EventArgs > (this, &FIFOEventTest::onComplex2);
|
||||
Complex2 -= Delegate < FIFOEventTest, Poco::EventArgs > (this, &FIFOEventTest::onComplex2);
|
||||
Complex2.notify ( this, args );
|
||||
poco_assert ( _count == 0 );
|
||||
|
||||
const EventArgs* pCArgs = &args;
|
||||
ConstComplex += Delegate < FIFOEventTest, const Foundation::EventArgs* > (this, &FIFOEventTest::onConstComplex);
|
||||
ConstComplex -= Delegate < FIFOEventTest, const Foundation::EventArgs* > (this, &FIFOEventTest::onConstComplex);
|
||||
ConstComplex += Delegate < FIFOEventTest, const Poco::EventArgs* > (this, &FIFOEventTest::onConstComplex);
|
||||
ConstComplex -= Delegate < FIFOEventTest, const Poco::EventArgs* > (this, &FIFOEventTest::onConstComplex);
|
||||
ConstComplex.notify ( this, pCArgs );
|
||||
poco_assert ( _count == 0 );
|
||||
|
||||
Const2Complex += Delegate < FIFOEventTest, const Foundation::EventArgs* const > (this, &FIFOEventTest::onConst2Complex);
|
||||
Const2Complex -= Delegate < FIFOEventTest, const Foundation::EventArgs* const > (this, &FIFOEventTest::onConst2Complex);
|
||||
Const2Complex += Delegate < FIFOEventTest, const Poco::EventArgs* const > (this, &FIFOEventTest::onConst2Complex);
|
||||
Const2Complex -= Delegate < FIFOEventTest, const Poco::EventArgs* const > (this, &FIFOEventTest::onConst2Complex);
|
||||
Const2Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 0 );
|
||||
}
|
||||
@@ -112,20 +114,20 @@ void FIFOEventTest::testSingleDelegate()
|
||||
poco_assert ( _count == 2 );
|
||||
|
||||
EventArgs* pArgs = &args;
|
||||
Complex += Delegate < FIFOEventTest, Foundation::EventArgs* > (this, &FIFOEventTest::onComplex);
|
||||
Complex += Delegate < FIFOEventTest, Poco::EventArgs* > (this, &FIFOEventTest::onComplex);
|
||||
Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 3 );
|
||||
|
||||
Complex2 += Delegate < FIFOEventTest, Foundation::EventArgs > (this, &FIFOEventTest::onComplex2);
|
||||
Complex2 += Delegate < FIFOEventTest, Poco::EventArgs > (this, &FIFOEventTest::onComplex2);
|
||||
Complex2.notify ( this, args );
|
||||
poco_assert ( _count == 4 );
|
||||
|
||||
const EventArgs* pCArgs = &args;
|
||||
ConstComplex += Delegate < FIFOEventTest, const Foundation::EventArgs* > (this, &FIFOEventTest::onConstComplex);
|
||||
ConstComplex += Delegate < FIFOEventTest, const Poco::EventArgs* > (this, &FIFOEventTest::onConstComplex);
|
||||
ConstComplex.notify ( this, pCArgs );
|
||||
poco_assert ( _count == 5 );
|
||||
|
||||
Const2Complex += Delegate < FIFOEventTest, const Foundation::EventArgs* const > (this, &FIFOEventTest::onConst2Complex);
|
||||
Const2Complex += Delegate < FIFOEventTest, const Poco::EventArgs* const > (this, &FIFOEventTest::onConst2Complex);
|
||||
Const2Complex.notify ( this, pArgs );
|
||||
poco_assert ( _count == 6 );
|
||||
// check if 2nd notify also works
|
||||
@@ -222,7 +224,7 @@ void FIFOEventTest::testFIFOOrder ()
|
||||
Simple.notify ( this, tmp );
|
||||
failmsg ("Notify should not work");
|
||||
}
|
||||
catch ( Foundation::InvalidArgumentException& )
|
||||
catch ( Poco::InvalidArgumentException& )
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -270,7 +272,7 @@ void FIFOEventTest::testFIFOOrderExpire ()
|
||||
Simple.notify ( this, tmp );
|
||||
failmsg ("Notify should not work");
|
||||
}
|
||||
catch ( Foundation::InvalidArgumentException& )
|
||||
catch ( Poco::InvalidArgumentException& )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -286,7 +288,7 @@ void FIFOEventTest::testExpire ()
|
||||
Simple += Expire < int > (Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onSimple), 500 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 1 );
|
||||
Foundation::Thread::sleep ( 700 );
|
||||
Poco::Thread::sleep ( 700 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 1 );
|
||||
}
|
||||
@@ -301,15 +303,15 @@ void FIFOEventTest::testExpireReRegister()
|
||||
Simple += Expire < int > (Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onSimple), 500 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 1 );
|
||||
Foundation::Thread::sleep ( 200 );
|
||||
Poco::Thread::sleep ( 200 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 2 );
|
||||
// renew registration
|
||||
Simple += Expire < int > (Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onSimple), 600 );
|
||||
Foundation::Thread::sleep( 400 );
|
||||
Poco::Thread::sleep( 400 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 3 );
|
||||
Foundation::Thread::sleep( 300 );
|
||||
Poco::Thread::sleep( 300 );
|
||||
Simple.notify ( this, tmp );
|
||||
poco_assert ( _count == 3 );
|
||||
}
|
||||
@@ -343,11 +345,11 @@ void FIFOEventTest::testOverwriteDelegate ()
|
||||
|
||||
void FIFOEventTest::testAsyncNotify ()
|
||||
{
|
||||
Foundation::FIFOEvent < int >* pSimple= new Foundation::FIFOEvent < int >();
|
||||
Poco::FIFOEvent < int >* pSimple= new Poco::FIFOEvent < int >();
|
||||
(*pSimple) += Delegate < FIFOEventTest, int > (this, &FIFOEventTest::onAsync);
|
||||
poco_assert ( _count == 0 );
|
||||
int tmp = 0;
|
||||
Foundation::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp );
|
||||
Poco::ActiveResult < int > retArg = pSimple->notifyAsync ( this, tmp );
|
||||
delete pSimple; // must work even when the event got deleted!
|
||||
pSimple = NULL;
|
||||
poco_assert ( _count == 0 );
|
||||
@@ -371,29 +373,29 @@ void FIFOEventTest::onConstSimple ( const void* pSender, const int& i )
|
||||
_count++;
|
||||
}
|
||||
|
||||
void FIFOEventTest::onComplex ( const void* pSender, Foundation::EventArgs* & i )
|
||||
void FIFOEventTest::onComplex ( const void* pSender, Poco::EventArgs* & i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void FIFOEventTest::onComplex2 ( const void* pSender, Foundation::EventArgs & i )
|
||||
void FIFOEventTest::onComplex2 ( const void* pSender, Poco::EventArgs & i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void FIFOEventTest::onConstComplex ( const void* pSender, const Foundation::EventArgs*& i )
|
||||
void FIFOEventTest::onConstComplex ( const void* pSender, const Poco::EventArgs*& i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void FIFOEventTest::onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i )
|
||||
void FIFOEventTest::onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i )
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
|
||||
void FIFOEventTest::onAsync ( const void* pSender, int& i )
|
||||
{
|
||||
Foundation::Thread::sleep ( 700 );
|
||||
Poco::Thread::sleep ( 700 );
|
||||
_count += LARGEINC ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FIFOEventTest.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FIFOEventTest.h#1 $
|
||||
//
|
||||
// Definition of the FIFOEventTest class.
|
||||
//
|
||||
@@ -31,28 +31,25 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef FIFOEventTest_INCLUDED
|
||||
#define FIFOEventTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
#include "Poco/FIFOEvent.h"
|
||||
#include "Poco/EventArgs.h"
|
||||
|
||||
#include "Foundation/FIFOEvent.h"
|
||||
#include "Foundation/EventArgs.h"
|
||||
|
||||
class FIFOEventTest: public CppUnit::TestCase
|
||||
{
|
||||
Foundation::FIFOEvent<int> Simple;
|
||||
Foundation::FIFOEvent<const int> ConstSimple;
|
||||
Foundation::FIFOEvent<Foundation::EventArgs*> Complex;
|
||||
Foundation::FIFOEvent<Foundation::EventArgs> Complex2;
|
||||
Foundation::FIFOEvent<const Foundation::EventArgs*> ConstComplex;
|
||||
Foundation::FIFOEvent<const Foundation::EventArgs * const> Const2Complex;
|
||||
Poco::FIFOEvent<int> Simple;
|
||||
Poco::FIFOEvent<const int> ConstSimple;
|
||||
Poco::FIFOEvent<Poco::EventArgs*> Complex;
|
||||
Poco::FIFOEvent<Poco::EventArgs> Complex2;
|
||||
Poco::FIFOEvent<const Poco::EventArgs*> ConstComplex;
|
||||
Poco::FIFOEvent<const Poco::EventArgs * const> Const2Complex;
|
||||
public:
|
||||
FIFOEventTest(const std::string& name);
|
||||
~FIFOEventTest();
|
||||
@@ -79,10 +76,10 @@ protected:
|
||||
void onSimple ( const void* pSender, int& i );
|
||||
void onSimpleOther ( const void* pSender, int& i );
|
||||
void onConstSimple ( const void* pSender, const int& i );
|
||||
void onComplex ( const void* pSender, Foundation::EventArgs* & i );
|
||||
void onComplex2 ( const void* pSender, Foundation::EventArgs & i );
|
||||
void onConstComplex ( const void* pSender, const Foundation::EventArgs*& i );
|
||||
void onConst2Complex ( const void* pSender, const Foundation::EventArgs * const & i );
|
||||
void onComplex ( const void* pSender, Poco::EventArgs* & i );
|
||||
void onComplex2 ( const void* pSender, Poco::EventArgs & i );
|
||||
void onConstComplex ( const void* pSender, const Poco::EventArgs*& i );
|
||||
void onConst2Complex ( const void* pSender, const Poco::EventArgs * const & i );
|
||||
void onAsync ( const void* pSender, int& i );
|
||||
|
||||
int getCount () const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FPETest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FPETest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FPETest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,10 +33,10 @@
|
||||
#include "FPETest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/FPEnvironment.h"
|
||||
#include "Poco/FPEnvironment.h"
|
||||
|
||||
|
||||
using Foundation::FPE;
|
||||
using Poco::FPE;
|
||||
|
||||
|
||||
FPETest::FPETest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FPETest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FPETest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FPETest.h#1 $
|
||||
//
|
||||
// Definition of the FPETest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define FPETest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FPETest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FileChannelTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FileChannelTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FileChannelTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,37 +33,37 @@
|
||||
#include "FileChannelTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/FileChannel.h"
|
||||
#include "Foundation/Message.h"
|
||||
#include "Foundation/AutoPtr.h"
|
||||
#include "Foundation/TemporaryFile.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Foundation/File.h"
|
||||
#include "Foundation/Path.h"
|
||||
#include "Foundation/Timestamp.h"
|
||||
#include "Foundation/DateTime.h"
|
||||
#include "Foundation/LocalDateTime.h"
|
||||
#include "Foundation/DateTimeFormatter.h"
|
||||
#include "Foundation/DateTimeFormat.h"
|
||||
#include "Foundation/NumberFormatter.h"
|
||||
#include "Foundation/DirectoryIterator.h"
|
||||
#include "Poco/FileChannel.h"
|
||||
#include "Poco/Message.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/TemporaryFile.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/Path.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/LocalDateTime.h"
|
||||
#include "Poco/DateTimeFormatter.h"
|
||||
#include "Poco/DateTimeFormat.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include "Poco/DirectoryIterator.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
using Foundation::FileChannel;
|
||||
using Foundation::Message;
|
||||
using Foundation::AutoPtr;
|
||||
using Foundation::TemporaryFile;
|
||||
using Foundation::Thread;
|
||||
using Foundation::File;
|
||||
using Foundation::Path;
|
||||
using Foundation::Timestamp;
|
||||
using Foundation::NumberFormatter;
|
||||
using Foundation::DateTime;
|
||||
using Foundation::LocalDateTime;
|
||||
using Foundation::DateTimeFormatter;
|
||||
using Foundation::DateTimeFormat;
|
||||
using Foundation::DirectoryIterator;
|
||||
using Poco::FileChannel;
|
||||
using Poco::Message;
|
||||
using Poco::AutoPtr;
|
||||
using Poco::TemporaryFile;
|
||||
using Poco::Thread;
|
||||
using Poco::File;
|
||||
using Poco::Path;
|
||||
using Poco::Timestamp;
|
||||
using Poco::NumberFormatter;
|
||||
using Poco::DateTime;
|
||||
using Poco::LocalDateTime;
|
||||
using Poco::DateTimeFormatter;
|
||||
using Poco::DateTimeFormat;
|
||||
using Poco::DirectoryIterator;
|
||||
|
||||
|
||||
FileChannelTest::FileChannelTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -348,6 +348,7 @@ void FileChannelTest::testCompress()
|
||||
{
|
||||
pChannel->log(msg);
|
||||
}
|
||||
Thread::sleep(3000); // allow time for background compression
|
||||
File f0(name + ".0.gz");
|
||||
assert (f0.exists());
|
||||
File f1(name + ".1.gz");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FileChannelTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FileChannelTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FileChannelTest.h#1 $
|
||||
//
|
||||
// Definition of the FileChannelTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define FileChannelTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FileChannelTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FileTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FileTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FileTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,21 +33,21 @@
|
||||
#include "FileTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/File.h"
|
||||
#include "Foundation/TemporaryFile.h"
|
||||
#include "Foundation/Path.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/TemporaryFile.h"
|
||||
#include "Poco/Path.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
|
||||
|
||||
using Foundation::File;
|
||||
using Foundation::TemporaryFile;
|
||||
using Foundation::Path;
|
||||
using Foundation::Exception;
|
||||
using Foundation::Timestamp;
|
||||
using Foundation::Thread;
|
||||
using Poco::File;
|
||||
using Poco::TemporaryFile;
|
||||
using Poco::Path;
|
||||
using Poco::Exception;
|
||||
using Poco::Timestamp;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
FileTest::FileTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FileTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FileTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FileTest.h#1 $
|
||||
//
|
||||
// Definition of the FileTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define FileTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FileTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FilesystemTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FilesystemTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FilesystemTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FilesystemTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FilesystemTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FilesystemTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the FilesystemTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define FilesystemTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FilesystemTestSuite
|
||||
|
||||
310
Foundation/testsuite/src/FormatTest.cpp
Normal file
310
Foundation/testsuite/src/FormatTest.cpp
Normal file
@@ -0,0 +1,310 @@
|
||||
//
|
||||
// FormatTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FormatTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Redistributions in any form must be accompanied by information on
|
||||
// how to obtain complete source code for this software and any
|
||||
// accompanying software that uses this software. The source code
|
||||
// must either be included in the distribution or be available for no
|
||||
// more than the cost of distribution plus a nominal fee, and must be
|
||||
// freely redistributable under reasonable conditions. For an
|
||||
// executable file, complete source code means the source code for all
|
||||
// modules it contains. It does not include source code for modules or
|
||||
// files that typically accompany the major components of the operating
|
||||
// system on which the executable file runs.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
#include "FormatTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Format.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Poco::format;
|
||||
using Poco::BadCastException;
|
||||
using Poco::Int64;
|
||||
using Poco::UInt64;
|
||||
|
||||
|
||||
FormatTest::FormatTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FormatTest::~FormatTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::testChar()
|
||||
{
|
||||
char c = 'a';
|
||||
std::string s(format("%c", c));
|
||||
assert (s == "a");
|
||||
s = format("%2c", c);
|
||||
assert (s == " a");
|
||||
s = format("%-2c", c);
|
||||
assert (s == "a ");
|
||||
|
||||
try
|
||||
{
|
||||
s = format("%c", std::string("foo"));
|
||||
fail("bad argument - must throw");
|
||||
}
|
||||
catch (BadCastException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::testInt()
|
||||
{
|
||||
int i = 42;
|
||||
std::string s(format("%d", i));
|
||||
assert (s == "42");
|
||||
s = format("%4d", i);
|
||||
assert (s == " 42");
|
||||
s = format("%04d", i);
|
||||
assert (s == "0042");
|
||||
|
||||
short h = 42;
|
||||
s = format("%hd", h);
|
||||
assert (s == "42");
|
||||
s = format("%4hd", h);
|
||||
assert (s == " 42");
|
||||
s = format("%04hd", h);
|
||||
assert (s == "0042");
|
||||
|
||||
unsigned short hu = 42;
|
||||
s = format("%hu", hu);
|
||||
assert (s == "42");
|
||||
s = format("%4hu", hu);
|
||||
assert (s == " 42");
|
||||
s = format("%04hu", hu);
|
||||
assert (s == "0042");
|
||||
|
||||
unsigned x = 0x42;
|
||||
s = format("%x", x);
|
||||
assert (s == "42");
|
||||
s = format("%4x", x);
|
||||
assert (s == " 42");
|
||||
s = format("%04x", x);
|
||||
assert (s == "0042");
|
||||
|
||||
unsigned o = 042;
|
||||
s = format("%o", o);
|
||||
assert (s == "42");
|
||||
s = format("%4o", o);
|
||||
assert (s == " 42");
|
||||
s = format("%04o", o);
|
||||
assert (s == "0042");
|
||||
|
||||
unsigned u = 42;
|
||||
s = format("%u", u);
|
||||
assert (s == "42");
|
||||
s = format("%4u", u);
|
||||
assert (s == " 42");
|
||||
s = format("%04u", u);
|
||||
assert (s == "0042");
|
||||
|
||||
long l = 42;
|
||||
s = format("%ld", l);
|
||||
assert (s == "42");
|
||||
s = format("%4ld", l);
|
||||
assert (s == " 42");
|
||||
s = format("%04ld", l);
|
||||
assert (s == "0042");
|
||||
|
||||
unsigned long ul = 42;
|
||||
s = format("%lu", ul);
|
||||
assert (s == "42");
|
||||
s = format("%4lu", ul);
|
||||
assert (s == " 42");
|
||||
s = format("%04lu", ul);
|
||||
assert (s == "0042");
|
||||
|
||||
unsigned long xl = 0x42;
|
||||
s = format("%lx", xl);
|
||||
assert (s == "42");
|
||||
s = format("%4lx", xl);
|
||||
assert (s == " 42");
|
||||
s = format("%04lx", xl);
|
||||
assert (s == "0042");
|
||||
|
||||
Int64 i64 = 42;
|
||||
s = format("%Ld", i64);
|
||||
assert (s == "42");
|
||||
s = format("%4Ld", i64);
|
||||
assert (s == " 42");
|
||||
s = format("%04Ld", i64);
|
||||
assert (s == "0042");
|
||||
|
||||
UInt64 ui64 = 42;
|
||||
s = format("%Lu", ui64);
|
||||
assert (s == "42");
|
||||
s = format("%4Lu", ui64);
|
||||
assert (s == " 42");
|
||||
s = format("%04Lu", ui64);
|
||||
assert (s == "0042");
|
||||
|
||||
x = 0xaa;
|
||||
s = format("%x", x);
|
||||
assert (s == "aa");
|
||||
s = format("%X", x);
|
||||
assert (s == "AA");
|
||||
|
||||
i = 42;
|
||||
s = format("%+d", i);
|
||||
assert (s == "+42");
|
||||
|
||||
i = -42;
|
||||
s = format("%+d", i);
|
||||
assert (s == "-42");
|
||||
s = format("%d", i);
|
||||
assert (s == "-42");
|
||||
|
||||
s = format("%d", i);
|
||||
assert (s == "-42");
|
||||
|
||||
x = 0x42;
|
||||
s = format("%#x", x);
|
||||
assert (s == "0x42");
|
||||
|
||||
try
|
||||
{
|
||||
s = format("%d", l);
|
||||
fail("bad argument - must throw");
|
||||
}
|
||||
catch (BadCastException&)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::testFloatFix()
|
||||
{
|
||||
double d = 1.5;
|
||||
std::string s(format("%f", d));
|
||||
assert (s.find("1.50") == 0);
|
||||
|
||||
s = format("%10f", d);
|
||||
assert (s.find(" 1.50") != std::string::npos);
|
||||
|
||||
s = format("%6.2f", d);
|
||||
assert (s == " 1.50");
|
||||
s = format("%-6.2f", d);
|
||||
assert (s == "1.50 ");
|
||||
|
||||
float f = 1.5;
|
||||
s = format("%hf", f);
|
||||
assert (s.find("1.50") == 0);
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::testFloatSci()
|
||||
{
|
||||
double d = 1.5;
|
||||
std::string s(format("%e", d));
|
||||
assert (s.find("1.50") == 0);
|
||||
assert (s.find("0e+0") != std::string::npos);
|
||||
|
||||
s = format("%20e", d);
|
||||
assert (s.find(" 1.50") != std::string::npos);
|
||||
assert (s.find("0e+0") != std::string::npos);
|
||||
|
||||
s = format("%10.2e", d);
|
||||
assert (s == " 1.50e+000" || s == " 1.50e+00");
|
||||
s = format("%-10.2e", d);
|
||||
assert (s == "1.50e+000 " || s == "1.50e+00 ");
|
||||
s = format("%-10.2E", d);
|
||||
assert (s == "1.50E+000 " || s == "1.50E+00 ");
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::testString()
|
||||
{
|
||||
std::string foo("foo");
|
||||
std::string s(format("%s", foo));
|
||||
assert (s == "foo");
|
||||
|
||||
s = format("%5s", foo);
|
||||
assert (s == " foo");
|
||||
|
||||
s = format("%-5s", foo);
|
||||
assert (s == "foo ");
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::testMultiple()
|
||||
{
|
||||
std::string s(format("aaa%dbbb%4dccc", 1, 2));
|
||||
assert (s == "aaa1bbb 2ccc");
|
||||
|
||||
s = format("%%%d%%%d%%%d", 1, 2, 3);
|
||||
assert (s == "%1%2%3");
|
||||
|
||||
s = format("%d%d%d%d", 1, 2, 3, 4);
|
||||
assert (s == "1234");
|
||||
|
||||
s = format("%d%d%d%d%d", 1, 2, 3, 4, 5);
|
||||
assert (s == "12345");
|
||||
|
||||
s = format("%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6);
|
||||
assert (s == "123456");
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FormatTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* FormatTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FormatTest");
|
||||
|
||||
CppUnit_addTest(pSuite, FormatTest, testChar);
|
||||
CppUnit_addTest(pSuite, FormatTest, testInt);
|
||||
CppUnit_addTest(pSuite, FormatTest, testFloatFix);
|
||||
CppUnit_addTest(pSuite, FormatTest, testFloatSci);
|
||||
CppUnit_addTest(pSuite, FormatTest, testString);
|
||||
CppUnit_addTest(pSuite, FormatTest, testMultiple);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
78
Foundation/testsuite/src/FormatTest.h
Normal file
78
Foundation/testsuite/src/FormatTest.h
Normal file
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// FormatTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FormatTest.h#1 $
|
||||
//
|
||||
// Definition of the FormatTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Redistributions in any form must be accompanied by information on
|
||||
// how to obtain complete source code for this software and any
|
||||
// accompanying software that uses this software. The source code
|
||||
// must either be included in the distribution or be available for no
|
||||
// more than the cost of distribution plus a nominal fee, and must be
|
||||
// freely redistributable under reasonable conditions. For an
|
||||
// executable file, complete source code means the source code for all
|
||||
// modules it contains. It does not include source code for modules or
|
||||
// files that typically accompany the major components of the operating
|
||||
// system on which the executable file runs.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef FormatTest_INCLUDED
|
||||
#define FormatTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class FormatTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
FormatTest(const std::string& name);
|
||||
~FormatTest();
|
||||
|
||||
void testChar();
|
||||
void testInt();
|
||||
void testFloatFix();
|
||||
void testFloatSci();
|
||||
void testString();
|
||||
void testMultiple();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // FormatTest_INCLUDED
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FoundationTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FoundationTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FoundationTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FoundationTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/FoundationTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/FoundationTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the FoundationTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define FoundationTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FoundationTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// GlobTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/GlobTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/GlobTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "GlobTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/Glob.h"
|
||||
#include "Foundation/File.h"
|
||||
#include "Foundation/Path.h"
|
||||
#include "Poco/Glob.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/Path.h"
|
||||
#include <fstream>
|
||||
|
||||
|
||||
using Foundation::Glob;
|
||||
using Foundation::File;
|
||||
using Foundation::Path;
|
||||
using Poco::Glob;
|
||||
using Poco::File;
|
||||
using Poco::Path;
|
||||
|
||||
|
||||
GlobTest::GlobTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// GlobTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/GlobTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/GlobTest.h#1 $
|
||||
//
|
||||
// Definition of the GlobTest class.
|
||||
//
|
||||
@@ -36,16 +36,9 @@
|
||||
#define GlobTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
#ifndef STD_SET_INCLUDED
|
||||
#include <set>
|
||||
#define STD_SET_INCLUDED
|
||||
#endif
|
||||
|
||||
|
||||
class GlobTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HMACEngineTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/HMACEngineTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/HMACEngineTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,13 +33,13 @@
|
||||
#include "HMACEngineTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/HMACEngine.h"
|
||||
#include "Foundation/MD5Engine.h"
|
||||
#include "Poco/HMACEngine.h"
|
||||
#include "Poco/MD5Engine.h"
|
||||
|
||||
|
||||
using Foundation::HMACEngine;
|
||||
using Foundation::MD5Engine;
|
||||
using Foundation::DigestEngine;
|
||||
using Poco::HMACEngine;
|
||||
using Poco::MD5Engine;
|
||||
using Poco::DigestEngine;
|
||||
|
||||
|
||||
HMACEngineTest::HMACEngineTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HMACEngineTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/HMACEngineTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/HMACEngineTest.h#1 $
|
||||
//
|
||||
// Definition of the HMACEngineTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HMACEngineTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HMACEngineTest: public CppUnit::TestCase
|
||||
|
||||
226
Foundation/testsuite/src/HashTest.cpp
Normal file
226
Foundation/testsuite/src/HashTest.cpp
Normal file
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// HashTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/HashTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "HashTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/HashTable.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
|
||||
|
||||
using namespace Poco;
|
||||
|
||||
|
||||
HashTest::HashTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HashTest::~HashTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void HashTest::testInsert()
|
||||
{
|
||||
std::string s1("str1");
|
||||
std::string s2("str2");
|
||||
HashTable < std::string, int > hashTable;
|
||||
poco_assert (!hashTable.exists(s1));
|
||||
hashTable.insert(s1, 13);
|
||||
poco_assert (hashTable.exists(s1));
|
||||
poco_assert (hashTable.get(s1) == 13);
|
||||
int retVal = 0;
|
||||
|
||||
poco_assert (hashTable.get(s1, retVal));
|
||||
poco_assert (retVal == 13);
|
||||
try
|
||||
{
|
||||
hashTable.insert(s1, 22);
|
||||
failmsg ("duplicate insert must fail");
|
||||
}
|
||||
catch(Exception&){}
|
||||
try
|
||||
{
|
||||
hashTable.get(s2);
|
||||
failmsg ("getting a non inserted item must fail");
|
||||
}
|
||||
catch(Exception&){}
|
||||
|
||||
poco_assert (!hashTable.exists(s2));
|
||||
hashTable.insert(s2, 13);
|
||||
poco_assert (hashTable.exists(s2));
|
||||
}
|
||||
|
||||
|
||||
void HashTest::testUpdate()
|
||||
{
|
||||
// add code for second test here
|
||||
std::string s1("str1");
|
||||
std::string s2("str2");
|
||||
HashTable < std::string, int > hashTable;
|
||||
hashTable.insert(s1, 13);
|
||||
hashTable.update(s1, 14);
|
||||
poco_assert (hashTable.exists(s1));
|
||||
poco_assert (hashTable.get(s1) == 14);
|
||||
int retVal = 0;
|
||||
|
||||
poco_assert (hashTable.get(s1, retVal));
|
||||
poco_assert (retVal == 14);
|
||||
|
||||
// updating a non existing item must work too
|
||||
hashTable.update(s2, 15);
|
||||
poco_assert (hashTable.get(s2) == 15);
|
||||
}
|
||||
|
||||
|
||||
void HashTest::testOverflow()
|
||||
{
|
||||
HashTable < std::string, int > hashTable(13);
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
hashTable.insert(Poco::NumberFormatter::format(i), i*i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
std::string tmp = Poco::NumberFormatter::format(i);
|
||||
poco_assert (hashTable.exists(tmp));
|
||||
poco_assert (hashTable.get(tmp) == i*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HashTest::testSize()
|
||||
{
|
||||
HashTable < std::string, int > hashTable(13);
|
||||
poco_assert (hashTable.size() == 0);
|
||||
Poco::UInt32 h1 = hashTable.insert("1", 1);
|
||||
poco_assert (hashTable.size() == 1);
|
||||
Poco::UInt32 h2 = hashTable.update("2", 2);
|
||||
poco_assert (hashTable.size() == 2);
|
||||
hashTable.remove("1");
|
||||
poco_assert (hashTable.size() == 1);
|
||||
hashTable.remove("3");
|
||||
poco_assert (hashTable.size() == 1);
|
||||
hashTable.removeRaw("2", h2);
|
||||
poco_assert (hashTable.size() == 0);
|
||||
hashTable.insert("1", 1);
|
||||
hashTable.insert("2", 2);
|
||||
poco_assert (hashTable.size() == 2);
|
||||
hashTable.clear();
|
||||
poco_assert (hashTable.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
void HashTest::testResize()
|
||||
{
|
||||
HashTable < std::string, int > hashTable(13);
|
||||
poco_assert (hashTable.size() == 0);
|
||||
hashTable.resize(19);
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
hashTable.insert(Poco::NumberFormatter::format(i), i*i);
|
||||
}
|
||||
hashTable.resize(1009);
|
||||
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
std::string tmp = Poco::NumberFormatter::format(i);
|
||||
poco_assert (hashTable.exists(tmp));
|
||||
poco_assert (hashTable.get(tmp) == i*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HashTest::testStatistic()
|
||||
{
|
||||
double relax = 0.001;
|
||||
HashTable < std::string, int > hashTable(13);
|
||||
poco_assert (hashTable.size() == 0);
|
||||
HashStatistic stat1(hashTable.currentState());
|
||||
poco_assert (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax);
|
||||
poco_assert (stat1.maxPositionsOfTable() == 13);
|
||||
poco_assert (stat1.maxEntriesPerHash() == 0);
|
||||
|
||||
hashTable.resize(19);
|
||||
stat1 = hashTable.currentState(true);
|
||||
poco_assert (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax);
|
||||
poco_assert (stat1.maxPositionsOfTable() == 19);
|
||||
poco_assert (stat1.maxEntriesPerHash() == 0);
|
||||
poco_assert (stat1.detailedEntriesPerHash().size() == 19);
|
||||
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
hashTable.insert(Poco::NumberFormatter::format(i), i*i);
|
||||
}
|
||||
stat1 = hashTable.currentState(true);
|
||||
double expAvg = 1024.0/ 19;
|
||||
poco_assert (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax));
|
||||
poco_assert (stat1.maxPositionsOfTable() == 19);
|
||||
poco_assert (stat1.maxEntriesPerHash() > expAvg);
|
||||
hashTable.resize(1009);
|
||||
stat1 = hashTable.currentState(true);
|
||||
|
||||
expAvg = 1024.0/ 1009;
|
||||
|
||||
poco_assert (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax));
|
||||
poco_assert (stat1.maxPositionsOfTable() == 1009);
|
||||
poco_assert (stat1.maxEntriesPerHash() > expAvg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void HashTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void HashTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* HashTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("HashTest");
|
||||
|
||||
CppUnit_addTest(pSuite, HashTest, testInsert);
|
||||
CppUnit_addTest(pSuite, HashTest, testUpdate);
|
||||
CppUnit_addTest(pSuite, HashTest, testOverflow);
|
||||
CppUnit_addTest(pSuite, HashTest, testSize);
|
||||
CppUnit_addTest(pSuite, HashTest, testResize);
|
||||
CppUnit_addTest(pSuite, HashTest, testStatistic);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
65
Foundation/testsuite/src/HashTest.h
Normal file
65
Foundation/testsuite/src/HashTest.h
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// HashTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/HashTest.h#1 $
|
||||
//
|
||||
// Definition of the HashTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef HashTest_INCLUDED
|
||||
#define HashTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class HashTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
HashTest(const std::string& name);
|
||||
~HashTest();
|
||||
|
||||
void testInsert();
|
||||
void testOverflow();
|
||||
void testUpdate();
|
||||
void testSize();
|
||||
void testResize();
|
||||
void testStatistic();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // HashTest_INCLUDED
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HexBinaryTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/HexBinaryTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/HexBinaryTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "HexBinaryTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/HexBinaryEncoder.h"
|
||||
#include "Foundation/HexBinaryDecoder.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/HexBinaryEncoder.h"
|
||||
#include "Poco/HexBinaryDecoder.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::HexBinaryEncoder;
|
||||
using Foundation::HexBinaryDecoder;
|
||||
using Foundation::DataFormatException;
|
||||
using Poco::HexBinaryEncoder;
|
||||
using Poco::HexBinaryDecoder;
|
||||
using Poco::DataFormatException;
|
||||
|
||||
|
||||
HexBinaryTest::HexBinaryTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HexBinaryTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/HexBinaryTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/HexBinaryTest.h#1 $
|
||||
//
|
||||
// Definition of the HexBinaryTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HexBinaryTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HexBinaryTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LRUCacheTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Foundation/testsuite/src/LRUCacheTest.cpp#5 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LRUCacheTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,16 +31,14 @@
|
||||
|
||||
|
||||
#include "LRUCacheTest.h"
|
||||
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/LRUCache.h"
|
||||
#include "Poco/Bugcheck.h"
|
||||
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Foundation/LRUCache.h"
|
||||
#include "Foundation/Bugcheck.h"
|
||||
|
||||
using namespace Foundation;
|
||||
|
||||
using namespace Poco;
|
||||
|
||||
|
||||
LRUCacheTest::LRUCacheTest(const std::string& name ): CppUnit::TestCase(name)
|
||||
@@ -69,8 +67,6 @@ void LRUCacheTest::testClear()
|
||||
poco_assert ( !aCache.has( 1 ) );
|
||||
poco_assert ( !aCache.has( 3 ) );
|
||||
poco_assert ( !aCache.has( 5 ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +78,7 @@ void LRUCacheTest::testCacheSize0()
|
||||
LRUCache < int, int > aCache( 0 );
|
||||
failmsg ("cache size of 0 is illegal, test should fail");
|
||||
}
|
||||
catch (Foundation::InvalidArgumentException&)
|
||||
catch (Poco::InvalidArgumentException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -111,8 +107,6 @@ void LRUCacheTest::testCacheSize1()
|
||||
|
||||
// removing illegal entries should work too
|
||||
aCache.remove(666);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +201,18 @@ void LRUCacheTest::testCacheSizeN()
|
||||
}
|
||||
|
||||
|
||||
void LRUCacheTest::testDuplicateAdd()
|
||||
{
|
||||
LRUCache < int, int > aCache( 3 );
|
||||
aCache.add(1, 2); // 1
|
||||
poco_assert (aCache.has(1));
|
||||
poco_assert (*aCache.get(1) == 2);
|
||||
aCache.add(1, 3);
|
||||
poco_assert (aCache.has(1));
|
||||
poco_assert (*aCache.get(1) == 3);
|
||||
}
|
||||
|
||||
|
||||
void LRUCacheTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -226,6 +232,7 @@ CppUnit::Test* LRUCacheTest::suite()
|
||||
CppUnit_addTest(pSuite, LRUCacheTest, testCacheSize1);
|
||||
CppUnit_addTest(pSuite, LRUCacheTest, testCacheSize2);
|
||||
CppUnit_addTest(pSuite, LRUCacheTest, testCacheSizeN);
|
||||
CppUnit_addTest(pSuite, LRUCacheTest, testDuplicateAdd);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LRUCacheTest.h
|
||||
//
|
||||
// $Id: $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LRUCacheTest.h#1 $
|
||||
//
|
||||
// Tests for LRUCache
|
||||
//
|
||||
@@ -35,12 +35,9 @@
|
||||
#define LRUCacheTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LRUCacheTest: public CppUnit::TestCase
|
||||
{
|
||||
@@ -53,7 +50,7 @@ public:
|
||||
void testCacheSize1();
|
||||
void testCacheSize2();
|
||||
void testCacheSizeN();
|
||||
|
||||
void testDuplicateAdd();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LineEndingConverterTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LineEndingConverterTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LineEndingConverterTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "LineEndingConverterTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/LineEndingConverter.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/LineEndingConverter.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Foundation::LineEnding;
|
||||
using Foundation::InputLineEndingConverter;
|
||||
using Foundation::OutputLineEndingConverter;
|
||||
using Foundation::StreamCopier;
|
||||
using Poco::LineEnding;
|
||||
using Poco::InputLineEndingConverter;
|
||||
using Poco::OutputLineEndingConverter;
|
||||
using Poco::StreamCopier;
|
||||
|
||||
|
||||
LineEndingConverterTest::LineEndingConverterTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LineEndingConverterTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LineEndingConverterTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LineEndingConverterTest.h#1 $
|
||||
//
|
||||
// Definition of the LineEndingConverterTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define LineEndingConverterTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LineEndingConverterTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LocalDateTimeTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LocalDateTimeTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LocalDateTimeTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,18 +33,18 @@
|
||||
#include "LocalDateTimeTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/LocalDateTime.h"
|
||||
#include "Foundation/DateTime.h"
|
||||
#include "Foundation/Timestamp.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Foundation/Timezone.h"
|
||||
#include "Poco/LocalDateTime.h"
|
||||
#include "Poco/DateTime.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Timezone.h"
|
||||
|
||||
|
||||
using Foundation::LocalDateTime;
|
||||
using Foundation::DateTime;
|
||||
using Foundation::Timestamp;
|
||||
using Foundation::Timespan;
|
||||
using Foundation::Timezone;
|
||||
using Poco::LocalDateTime;
|
||||
using Poco::DateTime;
|
||||
using Poco::Timestamp;
|
||||
using Poco::Timespan;
|
||||
using Poco::Timezone;
|
||||
|
||||
|
||||
LocalDateTimeTest::LocalDateTimeTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LocalDateTimeTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LocalDateTimeTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LocalDateTimeTest.h#1 $
|
||||
//
|
||||
// Definition of the LocalDateTimeTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define LocalDateTimeTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LocalDateTimeTest: public CppUnit::TestCase
|
||||
|
||||
109
Foundation/testsuite/src/LogStreamTest.cpp
Normal file
109
Foundation/testsuite/src/LogStreamTest.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// LogStreamTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LogStreamTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Redistributions in any form must be accompanied by information on
|
||||
// how to obtain complete source code for this software and any
|
||||
// accompanying software that uses this software. The source code
|
||||
// must either be included in the distribution or be available for no
|
||||
// more than the cost of distribution plus a nominal fee, and must be
|
||||
// freely redistributable under reasonable conditions. For an
|
||||
// executable file, complete source code means the source code for all
|
||||
// modules it contains. It does not include source code for modules or
|
||||
// files that typically accompany the major components of the operating
|
||||
// system on which the executable file runs.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
#include "LogStreamTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Logger.h"
|
||||
#include "Poco/LogStream.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "TestChannel.h"
|
||||
|
||||
|
||||
using Poco::Logger;
|
||||
using Poco::LogStream;
|
||||
using Poco::Channel;
|
||||
using Poco::Message;
|
||||
using Poco::AutoPtr;
|
||||
|
||||
|
||||
LogStreamTest::LogStreamTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LogStreamTest::~LogStreamTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LogStreamTest::testLogStream()
|
||||
{
|
||||
AutoPtr<TestChannel> pChannel = new TestChannel;
|
||||
Logger& root = Logger::root();
|
||||
root.setChannel(pChannel.get());
|
||||
|
||||
LogStream ls(root);
|
||||
|
||||
ls << "information" << ' ' << 1 << std::endl;
|
||||
assert (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION);
|
||||
assert (pChannel->list().begin()->getText() == "information 1");
|
||||
pChannel->list().clear();
|
||||
|
||||
ls.error() << "error" << std::endl;
|
||||
assert (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR);
|
||||
assert (pChannel->list().begin()->getText() == "error");
|
||||
pChannel->list().clear();
|
||||
}
|
||||
|
||||
|
||||
void LogStreamTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LogStreamTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* LogStreamTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("LogStreamTest");
|
||||
|
||||
CppUnit_addTest(pSuite, LogStreamTest, testLogStream);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
73
Foundation/testsuite/src/LogStreamTest.h
Normal file
73
Foundation/testsuite/src/LogStreamTest.h
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// LogStreamTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LogStreamTest.h#1 $
|
||||
//
|
||||
// Definition of the LogStreamTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Redistributions in any form must be accompanied by information on
|
||||
// how to obtain complete source code for this software and any
|
||||
// accompanying software that uses this software. The source code
|
||||
// must either be included in the distribution or be available for no
|
||||
// more than the cost of distribution plus a nominal fee, and must be
|
||||
// freely redistributable under reasonable conditions. For an
|
||||
// executable file, complete source code means the source code for all
|
||||
// modules it contains. It does not include source code for modules or
|
||||
// files that typically accompany the major components of the operating
|
||||
// system on which the executable file runs.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef LogStreamTest_INCLUDED
|
||||
#define LogStreamTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class LogStreamTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
LogStreamTest(const std::string& name);
|
||||
~LogStreamTest();
|
||||
|
||||
void testLogStream();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // LogStreamTest_INCLUDED
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggerTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggerTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggerTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "LoggerTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/Logger.h"
|
||||
#include "Foundation/AutoPtr.h"
|
||||
#include "Poco/Logger.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "TestChannel.h"
|
||||
|
||||
|
||||
using Foundation::Logger;
|
||||
using Foundation::Channel;
|
||||
using Foundation::Message;
|
||||
using Foundation::AutoPtr;
|
||||
using Poco::Logger;
|
||||
using Poco::Channel;
|
||||
using Poco::Message;
|
||||
using Poco::AutoPtr;
|
||||
|
||||
|
||||
LoggerTest::LoggerTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -84,6 +84,17 @@ void LoggerTest::testLogger()
|
||||
Logger& logger21 = Logger::get("Logger2.Logger1");
|
||||
Logger& logger22 = Logger::get("Logger2.Logger2");
|
||||
|
||||
std::vector<std::string> loggers;
|
||||
Logger::names(loggers);
|
||||
assert (loggers.size() == 7);
|
||||
assert (loggers[0] == "");
|
||||
assert (loggers[1] == "Logger1");
|
||||
assert (loggers[2] == "Logger1.Logger1");
|
||||
assert (loggers[3] == "Logger1.Logger2");
|
||||
assert (loggers[4] == "Logger2");
|
||||
assert (loggers[5] == "Logger2.Logger1");
|
||||
assert (loggers[6] == "Logger2.Logger2");
|
||||
|
||||
Logger::setLevel("Logger1", Message::PRIO_DEBUG);
|
||||
assert (logger1.is(Message::PRIO_DEBUG));
|
||||
assert (logger11.is(Message::PRIO_DEBUG));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggerTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggerTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggerTest.h#1 $
|
||||
//
|
||||
// Definition of the LoggerTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define LoggerTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LoggerTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggingFactoryTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingFactoryTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggingFactoryTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,30 +33,30 @@
|
||||
#include "LoggingFactoryTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/LoggingFactory.h"
|
||||
#include "Foundation/Instantiator.h"
|
||||
#include "Foundation/Channel.h"
|
||||
#include "Foundation/ConsoleChannel.h"
|
||||
#include "Foundation/FileChannel.h"
|
||||
#include "Foundation/SplitterChannel.h"
|
||||
#include "Foundation/Formatter.h"
|
||||
#include "Foundation/PatternFormatter.h"
|
||||
#include "Foundation/Message.h"
|
||||
#include "Foundation/AutoPtr.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/LoggingFactory.h"
|
||||
#include "Poco/Instantiator.h"
|
||||
#include "Poco/Channel.h"
|
||||
#include "Poco/ConsoleChannel.h"
|
||||
#include "Poco/FileChannel.h"
|
||||
#include "Poco/SplitterChannel.h"
|
||||
#include "Poco/Formatter.h"
|
||||
#include "Poco/PatternFormatter.h"
|
||||
#include "Poco/Message.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
using Foundation::LoggingFactory;
|
||||
using Foundation::Channel;
|
||||
using Foundation::ConsoleChannel;
|
||||
using Foundation::FileChannel;
|
||||
using Foundation::SplitterChannel;
|
||||
using Foundation::Formatter;
|
||||
using Foundation::PatternFormatter;
|
||||
using Foundation::Message;
|
||||
using Foundation::AutoPtr;
|
||||
using Foundation::Instantiator;
|
||||
using Poco::LoggingFactory;
|
||||
using Poco::Channel;
|
||||
using Poco::ConsoleChannel;
|
||||
using Poco::FileChannel;
|
||||
using Poco::SplitterChannel;
|
||||
using Poco::Formatter;
|
||||
using Poco::PatternFormatter;
|
||||
using Poco::Message;
|
||||
using Poco::AutoPtr;
|
||||
using Poco::Instantiator;
|
||||
|
||||
|
||||
namespace
|
||||
@@ -106,7 +106,7 @@ void LoggingFactoryTest::testBuiltins()
|
||||
AutoPtr<Channel> pUnknownChannel = fact.createChannel("UnknownChannel");
|
||||
fail("unknown class - must throw");
|
||||
}
|
||||
catch (Foundation::NotFoundException&)
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ void LoggingFactoryTest::testBuiltins()
|
||||
AutoPtr<Formatter> pUnknownFormatter = fact.createFormatter("UnknownFormatter");
|
||||
fail("unknown class - must throw");
|
||||
}
|
||||
catch (Foundation::NotFoundException&)
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggingFactoryTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingFactoryTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggingFactoryTest.h#1 $
|
||||
//
|
||||
// Definition of the LoggingFactoryTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define LoggingFactoryTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LoggingFactoryTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggingRegistryTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingRegistryTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggingRegistryTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,18 +33,18 @@
|
||||
#include "LoggingRegistryTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/LoggingRegistry.h"
|
||||
#include "Foundation/ConsoleChannel.h"
|
||||
#include "Foundation/PatternFormatter.h"
|
||||
#include "Foundation/AutoPtr.h"
|
||||
#include "Poco/LoggingRegistry.h"
|
||||
#include "Poco/ConsoleChannel.h"
|
||||
#include "Poco/PatternFormatter.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
|
||||
|
||||
using Foundation::LoggingRegistry;
|
||||
using Foundation::Channel;
|
||||
using Foundation::ConsoleChannel;
|
||||
using Foundation::Formatter;
|
||||
using Foundation::PatternFormatter;
|
||||
using Foundation::AutoPtr;
|
||||
using Poco::LoggingRegistry;
|
||||
using Poco::Channel;
|
||||
using Poco::ConsoleChannel;
|
||||
using Poco::Formatter;
|
||||
using Poco::PatternFormatter;
|
||||
using Poco::AutoPtr;
|
||||
|
||||
|
||||
LoggingRegistryTest::LoggingRegistryTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -88,7 +88,7 @@ void LoggingRegistryTest::testRegister()
|
||||
pC = reg.channelForName("c3");
|
||||
fail("not found - must throw");
|
||||
}
|
||||
catch (Foundation::NotFoundException&)
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ void LoggingRegistryTest::testUnregister()
|
||||
Channel* pC = reg.channelForName("c1");
|
||||
fail("unregistered - must throw");
|
||||
}
|
||||
catch (Foundation::NotFoundException&)
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ void LoggingRegistryTest::testUnregister()
|
||||
Formatter* pF = reg.formatterForName("f2");
|
||||
fail("unregistered - must throw");
|
||||
}
|
||||
catch (Foundation::NotFoundException&)
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggingRegistryTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingRegistryTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggingRegistryTest.h#1 $
|
||||
//
|
||||
// Definition of the LoggingRegistryTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define LoggingRegistryTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LoggingRegistryTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggingTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggingTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "SimpleFileChannelTest.h"
|
||||
#include "LoggingFactoryTest.h"
|
||||
#include "LoggingRegistryTest.h"
|
||||
#include "LogStreamTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* LoggingTestSuite::suite()
|
||||
@@ -51,6 +52,7 @@ CppUnit::Test* LoggingTestSuite::suite()
|
||||
pSuite->addTest(SimpleFileChannelTest::suite());
|
||||
pSuite->addTest(LoggingFactoryTest::suite());
|
||||
pSuite->addTest(LoggingRegistryTest::suite());
|
||||
pSuite->addTest(LogStreamTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// LoggingTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/LoggingTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/LoggingTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the LoggingTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define LoggingTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class LoggingTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MD2EngineTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/MD2EngineTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/MD2EngineTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,11 +33,11 @@
|
||||
#include "MD2EngineTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/MD2Engine.h"
|
||||
#include "Poco/MD2Engine.h"
|
||||
|
||||
|
||||
using Foundation::MD2Engine;
|
||||
using Foundation::DigestEngine;
|
||||
using Poco::MD2Engine;
|
||||
using Poco::DigestEngine;
|
||||
|
||||
|
||||
MD2EngineTest::MD2EngineTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MD2EngineTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/MD2EngineTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/MD2EngineTest.h#1 $
|
||||
//
|
||||
// Definition of the MD2EngineTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MD2EngineTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MD2EngineTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MD4EngineTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/MD4EngineTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/MD4EngineTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,11 +33,11 @@
|
||||
#include "MD4EngineTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/MD4Engine.h"
|
||||
#include "Poco/MD4Engine.h"
|
||||
|
||||
|
||||
using Foundation::MD4Engine;
|
||||
using Foundation::DigestEngine;
|
||||
using Poco::MD4Engine;
|
||||
using Poco::DigestEngine;
|
||||
|
||||
|
||||
MD4EngineTest::MD4EngineTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MD4EngineTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/MD4EngineTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/MD4EngineTest.h#1 $
|
||||
//
|
||||
// Definition of the MD4EngineTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MD4EngineTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MD4EngineTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MD5EngineTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/MD5EngineTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/MD5EngineTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,11 +33,11 @@
|
||||
#include "MD5EngineTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/MD5Engine.h"
|
||||
#include "Poco/MD5Engine.h"
|
||||
|
||||
|
||||
using Foundation::MD5Engine;
|
||||
using Foundation::DigestEngine;
|
||||
using Poco::MD5Engine;
|
||||
using Poco::DigestEngine;
|
||||
|
||||
|
||||
MD5EngineTest::MD5EngineTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MD5EngineTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/MD5EngineTest.h#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/MD5EngineTest.h#1 $
|
||||
//
|
||||
// Definition of the MD5EngineTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MD5EngineTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Foundation_Foundation_INCLUDED
|
||||
#include "Foundation/Foundation.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MD5EngineTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ManifestTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Foundation/testsuite/src/ManifestTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Foundation/testsuite/src/ManifestTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,13 +33,13 @@
|
||||
#include "ManifestTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Foundation/Manifest.h"
|
||||
#include "Foundation/MetaObject.h"
|
||||
#include "Poco/Manifest.h"
|
||||
#include "Poco/MetaObject.h"
|
||||
#include <set>
|
||||
|
||||
|
||||
using Foundation::Manifest;
|
||||
using Foundation::MetaObject;
|
||||
using Poco::Manifest;
|
||||
using Poco::MetaObject;
|
||||
|
||||
|
||||
class MfTestBase
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user