merge some changes from develop branch; modernize and clean-up code; remove support for compiling without POCO_WIN32_UTF8

This commit is contained in:
Günter Obiltschnig
2020-01-09 10:08:09 +01:00
parent 7c177b6f89
commit 1bf40a0cd2
389 changed files with 3029 additions and 4111 deletions

View File

@@ -16,6 +16,7 @@
using Poco::AutoPtr;
using Poco::makeAuto;
using Poco::NullPointerException;
@@ -28,6 +29,14 @@ namespace
{
++_count;
}
explicit TestObj(int value): _rc(1)
{
}
TestObj(int value1, const std::string& value2): _rc(1)
{
}
void duplicate()
{
@@ -92,6 +101,14 @@ void AutoPtrTest::testAutoPtr()
ptr3 = ptr2;
assertTrue (ptr2->rc() == 2);
assertTrue (TestObj::count() > 0);
AutoPtr<TestObj> ptr4 = std::move(ptr);
assertTrue (ptr4->rc() == 1);
assertTrue (ptr.isNull());
ptr3 = std::move(ptr4);
assertTrue (ptr4.isNull());
assertTrue (ptr3->rc() == 1);
}
assertTrue (TestObj::count() == 0);
}
@@ -165,6 +182,19 @@ void AutoPtrTest::testOps()
}
void AutoPtrTest::testMakeAuto()
{
AutoPtr<TestObj> ptr = makeAuto<TestObj>();
assertTrue (ptr->rc() == 1);
ptr = makeAuto<TestObj>(42);
assertTrue (ptr->rc() == 1);
ptr = makeAuto<TestObj>(42, "fortytwo");
assertTrue (ptr->rc() == 1);
}
void AutoPtrTest::setUp()
{
}
@@ -181,6 +211,7 @@ CppUnit::Test* AutoPtrTest::suite()
CppUnit_addTest(pSuite, AutoPtrTest, testAutoPtr);
CppUnit_addTest(pSuite, AutoPtrTest, testOps);
CppUnit_addTest(pSuite, AutoPtrTest, testMakeAuto);
return pSuite;
}