mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 19:51:58 +01:00
trunk/branch integration: unit test integration
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// UUIDTest.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Foundation/testsuite/src/UUIDTest.cpp#2 $
|
||||
// $Id: //poco/1.4/Foundation/testsuite/src/UUIDTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -72,40 +72,40 @@ void UUIDTest::testBuffer()
|
||||
|
||||
void UUIDTest::testCompare()
|
||||
{
|
||||
UUID nil;
|
||||
assert (nil.isNil());
|
||||
assert (UUID::nil().isNil());
|
||||
|
||||
UUID uuid1 = nil;
|
||||
UUID uuid2;
|
||||
assert (uuid1.isNil());
|
||||
assert (uuid1 == nil);
|
||||
assert (!(uuid1 != nil));
|
||||
assert (uuid1 >= nil);
|
||||
assert (uuid1 <= nil);
|
||||
assert (!(uuid1 > nil));
|
||||
assert (!(uuid1 < nil));
|
||||
assert (uuid1.toString() == "00000000-0000-0000-0000-000000000000");
|
||||
|
||||
uuid1 = UUID::dns();
|
||||
assert (!uuid1.isNil());
|
||||
assert (uuid1 != nil);
|
||||
assert (!(uuid1 == nil));
|
||||
assert (uuid1 >= nil);
|
||||
assert (!(uuid1 <= nil));
|
||||
assert (uuid1 > nil);
|
||||
assert (!(uuid1 < nil));
|
||||
assert (uuid1.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8");
|
||||
UUID null;
|
||||
assert (null.isNull());
|
||||
assert (UUID::null().isNull());
|
||||
|
||||
UUID uuid1 = null;
|
||||
UUID uuid2;
|
||||
assert (uuid1.isNull());
|
||||
assert (uuid1 == null);
|
||||
assert (!(uuid1 != null));
|
||||
assert (uuid1 >= null);
|
||||
assert (uuid1 <= null);
|
||||
assert (!(uuid1 > null));
|
||||
assert (!(uuid1 < null));
|
||||
assert (uuid1.toString() == "00000000-0000-0000-0000-000000000000");
|
||||
|
||||
uuid1 = UUID::dns();
|
||||
assert (!uuid1.isNull());
|
||||
assert (uuid1 != null);
|
||||
assert (!(uuid1 == null));
|
||||
assert (uuid1 >= null);
|
||||
assert (!(uuid1 <= null));
|
||||
assert (uuid1 > null);
|
||||
assert (!(uuid1 < null));
|
||||
assert (uuid1.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8");
|
||||
|
||||
assert (nil != uuid1);
|
||||
assert (!(nil == uuid1));
|
||||
assert (!(nil >= uuid1));
|
||||
assert (nil <= uuid1);
|
||||
assert (!(nil > uuid1));
|
||||
assert (nil < uuid1);
|
||||
|
||||
uuid2 = uuid1;
|
||||
assert (uuid2 == uuid1);
|
||||
assert (null != uuid1);
|
||||
assert (!(null == uuid1));
|
||||
assert (!(null >= uuid1));
|
||||
assert (null <= uuid1);
|
||||
assert (!(null > uuid1));
|
||||
assert (null < uuid1);
|
||||
|
||||
uuid2 = uuid1;
|
||||
assert (uuid2 == uuid1);
|
||||
assert (!(uuid2 != uuid1));
|
||||
assert (uuid2 >= uuid1);
|
||||
assert (uuid2 <= uuid1);
|
||||
@@ -160,9 +160,19 @@ void UUIDTest::testSwap()
|
||||
UUID uuid2("d2ee4220-3625-11d9-9669-0800200c9a66");
|
||||
uuid1.swap(uuid2);
|
||||
assert (uuid1.toString() == "d2ee4220-3625-11d9-9669-0800200c9a66");
|
||||
assert (uuid2.toString() == "db4fa7e9-9e62-4597-99e0-b1ec0b59800e");
|
||||
assert (uuid2.toString() == "db4fa7e9-9e62-4597-99e0-b1ec0b59800e");
|
||||
}
|
||||
|
||||
void UUIDTest::testTryParse()
|
||||
{
|
||||
UUID uuid;
|
||||
assert (uuid.tryParse("6BA7B810-9DAD-11D1-80B4-00C04FD430C8"));
|
||||
assert (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8");
|
||||
|
||||
UUID notUuid;
|
||||
assert (!notUuid.tryParse("not a uuid"));
|
||||
assert (notUuid.isNull());
|
||||
}
|
||||
|
||||
void UUIDTest::setUp()
|
||||
{
|
||||
@@ -181,9 +191,10 @@ CppUnit::Test* UUIDTest::suite()
|
||||
CppUnit_addTest(pSuite, UUIDTest, testParse);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testBuffer);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testCompare);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testVersion);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testVariant);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testSwap);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testVersion);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testVariant);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testSwap);
|
||||
CppUnit_addTest(pSuite, UUIDTest, testTryParse);
|
||||
|
||||
return pSuite;
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user