mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-23 10:37:11 +02:00
Update POCO library.
This commit is contained in:
2
vendor/POCO/Util/testsuite/Makefile
vendored
2
vendor/POCO/Util/testsuite/Makefile
vendored
@ -9,7 +9,7 @@ include $(POCO_BASE)/build/rules/global
|
||||
objects = AbstractConfigurationTest ConfigurationTestSuite \
|
||||
ConfigurationMapperTest ConfigurationViewTest Driver \
|
||||
HelpFormatterTest IniFileConfigurationTest LayeredConfigurationTest \
|
||||
LoggingConfiguratorTest MapConfigurationTest \
|
||||
LocalConfigurationViewTest LoggingConfiguratorTest MapConfigurationTest \
|
||||
OptionProcessorTest OptionSetTest OptionTest \
|
||||
OptionsTestSuite PropertyFileConfigurationTest \
|
||||
SystemConfigurationTest UtilTestSuite XMLConfigurationTest \
|
||||
|
1
vendor/POCO/Util/testsuite/TestSuite.progen
vendored
1
vendor/POCO/Util/testsuite/TestSuite.progen
vendored
@ -7,4 +7,5 @@ vc.project.platforms = Win32
|
||||
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md
|
||||
vc.project.prototype = TestSuite_vs90.vcproj
|
||||
vc.project.compiler.include = ..\\..\\Foundation\\include;..\\..\\XML\\include;..\\..\\JSON\\include
|
||||
vc.project.compiler.additionalOptions = /Zc:__cplusplus
|
||||
vc.project.linker.dependencies.Win32 = iphlpapi.lib
|
||||
|
@ -607,6 +607,7 @@
|
||||
<ClInclude Include="src\IniFileConfigurationTest.h"/>
|
||||
<ClInclude Include="src\JSONConfigurationTest.h"/>
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h"/>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h"/>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h"/>
|
||||
<ClInclude Include="src\MapConfigurationTest.h"/>
|
||||
<ClInclude Include="src\OptionProcessorTest.h"/>
|
||||
@ -656,6 +657,9 @@
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -90,6 +90,9 @@
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -173,6 +176,9 @@
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -607,6 +607,7 @@
|
||||
<ClInclude Include="src\IniFileConfigurationTest.h"/>
|
||||
<ClInclude Include="src\JSONConfigurationTest.h"/>
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h"/>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h"/>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h"/>
|
||||
<ClInclude Include="src\MapConfigurationTest.h"/>
|
||||
<ClInclude Include="src\OptionProcessorTest.h"/>
|
||||
@ -656,6 +657,9 @@
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -90,6 +90,9 @@
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -173,6 +176,9 @@
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -607,6 +607,7 @@
|
||||
<ClInclude Include="src\IniFileConfigurationTest.h"/>
|
||||
<ClInclude Include="src\JSONConfigurationTest.h"/>
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h"/>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h"/>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h"/>
|
||||
<ClInclude Include="src\MapConfigurationTest.h"/>
|
||||
<ClInclude Include="src\OptionProcessorTest.h"/>
|
||||
@ -656,6 +657,9 @@
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -90,6 +90,9 @@
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -173,6 +176,9 @@
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
1009
vendor/POCO/Util/testsuite/TestSuite_vs170.vcxproj
vendored
Normal file
1009
vendor/POCO/Util/testsuite/TestSuite_vs170.vcxproj
vendored
Normal file
File diff suppressed because it is too large
Load Diff
234
vendor/POCO/Util/testsuite/TestSuite_vs170.vcxproj.filters
vendored
Normal file
234
vendor/POCO/Util/testsuite/TestSuite_vs170.vcxproj.filters
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Application">
|
||||
<UniqueIdentifier>{6da2c515-b00e-4fae-b2b5-aa3588fa9ee5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Application\Header Files">
|
||||
<UniqueIdentifier>{363beeac-3d37-4eda-b2af-967dd3500746}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Application\Source Files">
|
||||
<UniqueIdentifier>{b6d3f832-90b4-4893-b5c5-50c92c2222da}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite">
|
||||
<UniqueIdentifier>{6e72e80f-b934-4f32-a093-9fcdaa489717}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Header Files">
|
||||
<UniqueIdentifier>{24d80eaa-600a-4289-8049-251db65b6a04}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Suite\Source Files">
|
||||
<UniqueIdentifier>{c89f0423-2a46-41e7-8e44-9e0c722e1a2f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver">
|
||||
<UniqueIdentifier>{1ef062b8-43ea-4e20-a3b4-8100dbf5d3f5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="_Driver\Source Files">
|
||||
<UniqueIdentifier>{2e9a3808-48c8-4169-b04e-29635ebc21af}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Configuration">
|
||||
<UniqueIdentifier>{da024c3a-2123-4f46-a0f6-9c83ea0dd02e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Configuration\Header Files">
|
||||
<UniqueIdentifier>{00043fe8-b671-499b-b347-08ba31776766}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Configuration\Source Files">
|
||||
<UniqueIdentifier>{2f873f5e-88f6-4eb0-99e5-090c792c425e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Options">
|
||||
<UniqueIdentifier>{dd6f9455-e392-4e80-b23d-b960a7c3ae7e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Options\Header Files">
|
||||
<UniqueIdentifier>{3fbdada5-c2d5-492e-809d-e0d1a75ce544}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Options\Source Files">
|
||||
<UniqueIdentifier>{7e4998f0-fb0a-449f-8e1d-756f8e096e55}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Windows">
|
||||
<UniqueIdentifier>{9bc91c8d-03d5-4ab3-b5c6-f45d2d73ef9c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Windows\Header Files">
|
||||
<UniqueIdentifier>{eccedab4-9508-4718-b7bf-3e1e1d8bd76d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Windows\Source Files">
|
||||
<UniqueIdentifier>{d41c00e9-b185-4b54-8b48-410f9fae9fb3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Timer">
|
||||
<UniqueIdentifier>{2656a8b9-839b-4c6c-ad8f-f6f08d85e6e1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Timer\Header Files">
|
||||
<UniqueIdentifier>{74c99947-4001-4143-b46f-12fc00f1bb3e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Timer\Source Files">
|
||||
<UniqueIdentifier>{6f467c16-7a22-4a9e-ba79-6d5025cf2666}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\UtilTestSuite.h">
|
||||
<Filter>_Suite\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\AbstractConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ConfigurationMapperTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ConfigurationTestSuite.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ConfigurationViewTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\FilesystemConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\IniFileConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\JSONConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LayeredConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LoggingConfiguratorTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\LocalConfigurationViewTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\MapConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\PropertyFileConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\SystemConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\XMLConfigurationTest.h">
|
||||
<Filter>Configuration\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\HelpFormatterTest.h">
|
||||
<Filter>Options\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\OptionProcessorTest.h">
|
||||
<Filter>Options\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\OptionSetTest.h">
|
||||
<Filter>Options\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\OptionsTestSuite.h">
|
||||
<Filter>Options\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\OptionTest.h">
|
||||
<Filter>Options\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ValidatorTest.h">
|
||||
<Filter>Options\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WinConfigurationTest.h">
|
||||
<Filter>Windows\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WindowsTestSuite.h">
|
||||
<Filter>Windows\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WinRegistryTest.h">
|
||||
<Filter>Windows\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WinServiceTest.h">
|
||||
<Filter>Windows\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\TimerTest.h">
|
||||
<Filter>Timer\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\TimerTestSuite.h">
|
||||
<Filter>Timer\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\UtilTestSuite.cpp">
|
||||
<Filter>_Suite\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Driver.cpp">
|
||||
<Filter>_Driver\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\AbstractConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ConfigurationMapperTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ConfigurationTestSuite.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ConfigurationViewTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\FilesystemConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\IniFileConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\JSONConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LayeredConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LocalConfigurationViewTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LoggingConfiguratorTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\MapConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\PropertyFileConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SystemConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\XMLConfigurationTest.cpp">
|
||||
<Filter>Configuration\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\HelpFormatterTest.cpp">
|
||||
<Filter>Options\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\OptionProcessorTest.cpp">
|
||||
<Filter>Options\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\OptionSetTest.cpp">
|
||||
<Filter>Options\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\OptionsTestSuite.cpp">
|
||||
<Filter>Options\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\OptionTest.cpp">
|
||||
<Filter>Options\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\ValidatorTest.cpp">
|
||||
<Filter>Options\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WinConfigurationTest.cpp">
|
||||
<Filter>Windows\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WindowsTestSuite.cpp">
|
||||
<Filter>Windows\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WinRegistryTest.cpp">
|
||||
<Filter>Windows\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WinServiceTest.cpp">
|
||||
<Filter>Windows\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TimerTest.cpp">
|
||||
<Filter>Timer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TimerTestSuite.cpp">
|
||||
<Filter>Timer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -491,6 +491,8 @@
|
||||
RelativePath=".\src\JSONConfigurationTest.h"/>
|
||||
<File
|
||||
RelativePath=".\src\LayeredConfigurationTest.h"/>
|
||||
<File
|
||||
RelativePath=".\src\LocalConfigurationTest.h"/>
|
||||
<File
|
||||
RelativePath=".\src\LoggingConfiguratorTest.h"/>
|
||||
<File
|
||||
@ -520,6 +522,8 @@
|
||||
RelativePath=".\src\JSONConfigurationTest.cpp"/>
|
||||
<File
|
||||
RelativePath=".\src\LayeredConfigurationTest.cpp"/>
|
||||
<File
|
||||
RelativePath=".\src\LocalConfigurationViewTest.cpp"/>
|
||||
<File
|
||||
RelativePath=".\src\LoggingConfiguratorTest.cpp"/>
|
||||
<File
|
||||
|
@ -55,14 +55,14 @@ void AbstractConfigurationTest::testHasProperty()
|
||||
void AbstractConfigurationTest::testGetString()
|
||||
{
|
||||
AutoPtr<AbstractConfiguration> pConf = createConfiguration();
|
||||
|
||||
|
||||
assertTrue (pConf->getString("prop1") == "foo");
|
||||
assertTrue (pConf->getString("prop2") == "bar");
|
||||
assertTrue (pConf->getString("prop3.string1") == "foo");
|
||||
assertTrue (pConf->getString("prop3.string2") == "bar");
|
||||
assertTrue (pConf->getString("ref1") == "foobar");
|
||||
assertTrue (pConf->getRawString("ref1") == "${prop3.string1}${prop3.string2}");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string res = pConf->getString("foo");
|
||||
@ -71,7 +71,7 @@ void AbstractConfigurationTest::testGetString()
|
||||
catch (Poco::NotFoundException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (pConf->getString("prop1", "FOO") == "foo");
|
||||
assertTrue (pConf->getString("prop2", "BAR") == "bar");
|
||||
assertTrue (pConf->getString("prop3.string1", "FOO") == "foo");
|
||||
@ -89,7 +89,7 @@ void AbstractConfigurationTest::testGetInt()
|
||||
assertTrue (pConf->getInt("prop4.hex") == 0x1f);
|
||||
assertTrue (pConf->getUInt("prop4.hex") == 0x1f);
|
||||
assertTrue (pConf->getInt("ref2") == 42);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pConf->getInt("prop1");
|
||||
@ -98,7 +98,7 @@ void AbstractConfigurationTest::testGetInt()
|
||||
catch (Poco::SyntaxException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (pConf->getInt("prop4.int1", 100) == 42);
|
||||
assertTrue (pConf->getInt("prop4.int2", 100) == -42);
|
||||
assertTrue (pConf->getInt("prop4.int3", 100) == 100);
|
||||
@ -140,7 +140,7 @@ void AbstractConfigurationTest::testGetDouble()
|
||||
|
||||
assertTrue (pConf->getDouble("prop4.double1") == 1);
|
||||
assertTrue (pConf->getDouble("prop4.double2") == -1.5);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pConf->getDouble("prop1");
|
||||
@ -149,7 +149,7 @@ void AbstractConfigurationTest::testGetDouble()
|
||||
catch (Poco::SyntaxException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (pConf->getDouble("prop4.double1", 123.5) == 1);
|
||||
assertTrue (pConf->getDouble("prop4.double2", 123.5) == -1.5);
|
||||
assertTrue (pConf->getDouble("prop4.double3", 123.5) == 123.5);
|
||||
@ -191,7 +191,7 @@ void AbstractConfigurationTest::testExpand()
|
||||
|
||||
assertTrue (pConf->getString("ref1") == "foobar");
|
||||
assertTrue (pConf->getInt("ref2") == 42);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string s = pConf->getString("ref3");
|
||||
@ -200,16 +200,16 @@ void AbstractConfigurationTest::testExpand()
|
||||
catch (Poco::CircularReferenceException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (pConf->getString("ref5") == "${refx}");
|
||||
assertTrue (pConf->getString("ref6") == "${refx}");
|
||||
|
||||
|
||||
assertTrue (pConf->expand("answer=${prop4.int1}") == "answer=42");
|
||||
assertTrue (pConf->expand("bool5='${prop4.bool5}'") == "bool5='Yes'");
|
||||
assertTrue (pConf->expand("undef='${undef}'") == "undef='${undef}'");
|
||||
assertTrue (pConf->expand("deep='${ref1}'") == "deep='foobar'");
|
||||
assertTrue (pConf->expand("deep='${ref7}'") == "deep='foobar'");
|
||||
|
||||
|
||||
assertTrue (pConf->getString("dollar.atend") == "foo$");
|
||||
assertTrue (pConf->getString("dollar.middle") == "foo$bar");
|
||||
}
|
||||
@ -261,7 +261,7 @@ void AbstractConfigurationTest::testSetDouble()
|
||||
pConf->setDouble("set.double1", 1.5);
|
||||
pConf->setDouble("set.double2", -1.5);
|
||||
assertTrue (pConf->getDouble("set.double1") == 1.5);
|
||||
assertTrue (pConf->getDouble("set.double2") == -1.5);
|
||||
assertTrue (pConf->getDouble("set.double2") == -1.5);
|
||||
}
|
||||
|
||||
|
||||
@ -282,25 +282,25 @@ void AbstractConfigurationTest::testChangeEvents()
|
||||
|
||||
pConf->propertyChanging += Poco::delegate(this, &AbstractConfigurationTest::onPropertyChanging);
|
||||
pConf->propertyChanged += Poco::delegate(this, &AbstractConfigurationTest::onPropertyChanged);
|
||||
|
||||
|
||||
pConf->setString("set.string1", "foobar");
|
||||
assertTrue (_changingKey == "set.string1");
|
||||
assertTrue (_changingValue == "foobar");
|
||||
assertTrue (_changedKey == "set.string1");
|
||||
assertTrue (_changedValue == "foobar");
|
||||
|
||||
|
||||
pConf->setInt("set.int1", 42);
|
||||
assertTrue (_changingKey == "set.int1");
|
||||
assertTrue (_changingValue == "42");
|
||||
assertTrue (_changedKey == "set.int1");
|
||||
assertTrue (_changedValue == "42");
|
||||
|
||||
|
||||
pConf->setDouble("set.double1", 1.5);
|
||||
assertTrue (_changingKey == "set.double1");
|
||||
assertTrue (_changingValue == "1.5");
|
||||
assertTrue (_changedKey == "set.double1");
|
||||
assertTrue (_changedValue == "1.5");
|
||||
|
||||
|
||||
pConf->setBool("set.bool1", true);
|
||||
assertTrue (_changingKey == "set.bool1");
|
||||
assertTrue (_changingValue == "true");
|
||||
@ -344,7 +344,7 @@ void AbstractConfigurationTest::testKeys()
|
||||
|
||||
pConf->keys("prop1", keys);
|
||||
assertTrue (keys.empty());
|
||||
|
||||
|
||||
pConf->keys("prop3", keys);
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
@ -398,7 +398,7 @@ void AbstractConfigurationTest::testRemove()
|
||||
AbstractConfiguration::Ptr AbstractConfigurationTest::createConfiguration() const
|
||||
{
|
||||
AbstractConfiguration::Ptr pConfig = allocConfiguration();
|
||||
|
||||
|
||||
pConfig->setString("prop1", "foo");
|
||||
pConfig->setString("prop2", "bar");
|
||||
pConfig->setString("prop3.string1", "foo");
|
||||
|
@ -44,10 +44,10 @@ public:
|
||||
void testRemove();
|
||||
void testChangeEvents();
|
||||
void testRemoveEvents();
|
||||
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
|
||||
void onPropertyChanging(const void*, Poco::Util::AbstractConfiguration::KeyValue& kv);
|
||||
void onPropertyChanged(const void*, const Poco::Util::AbstractConfiguration::KeyValue& kv);
|
||||
void onPropertyRemoving(const void*, const std::string& key);
|
||||
|
@ -52,10 +52,10 @@ void ConfigurationMapperTest::testMapper1()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pMapper->getString("prop5.string1") == "foo");
|
||||
assertTrue (pMapper->getString("prop5.sub1.string1") == "FOO");
|
||||
|
||||
|
||||
pMapper->setString("prop5.string3", "baz");
|
||||
assertTrue (pMapper->getString("prop5.string3") == "baz");
|
||||
assertTrue (pConf->getString("prop5.string3") == "baz");
|
||||
@ -92,7 +92,7 @@ void ConfigurationMapperTest::testMapper2()
|
||||
|
||||
assertTrue (pMapper->getString("root.conf.string1") == "foo");
|
||||
assertTrue (pMapper->getString("root.conf.sub1.string1") == "FOO");
|
||||
|
||||
|
||||
pMapper->setString("root.conf.string3", "baz");
|
||||
assertTrue (pMapper->getString("root.conf.string3") == "baz");
|
||||
assertTrue (pConf->getString("prop5.string3") == "baz");
|
||||
@ -126,10 +126,10 @@ void ConfigurationMapperTest::testMapper3()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pMapper->getString("root.prop5.string1") == "foo");
|
||||
assertTrue (pMapper->getString("root.prop5.sub1.string1") == "FOO");
|
||||
|
||||
|
||||
pMapper->setString("root.prop5.string3", "baz");
|
||||
assertTrue (pMapper->getString("root.prop5.string3") == "baz");
|
||||
assertTrue (pConf->getString("prop5.string3") == "baz");
|
||||
@ -155,10 +155,10 @@ void ConfigurationMapperTest::testMapper4()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pMapper->getString("string1") == "foo");
|
||||
assertTrue (pMapper->getString("sub1.string1") == "FOO");
|
||||
|
||||
|
||||
pMapper->setString("string3", "baz");
|
||||
assertTrue (pMapper->getString("string3") == "baz");
|
||||
assertTrue (pConf->getString("prop5.string3") == "baz");
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "ConfigurationTestSuite.h"
|
||||
#include "AbstractConfigurationTest.h"
|
||||
#include "ConfigurationViewTest.h"
|
||||
#include "LocalConfigurationViewTest.h"
|
||||
#include "ConfigurationMapperTest.h"
|
||||
#include "MapConfigurationTest.h"
|
||||
#include "LayeredConfigurationTest.h"
|
||||
@ -28,6 +29,7 @@ CppUnit::Test* ConfigurationTestSuite::suite()
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ConfigurationTestSuite");
|
||||
|
||||
pSuite->addTest(ConfigurationViewTest::suite());
|
||||
pSuite->addTest(LocalConfigurationViewTest::suite());
|
||||
pSuite->addTest(ConfigurationMapperTest::suite());
|
||||
pSuite->addTest(MapConfigurationTest::suite());
|
||||
pSuite->addTest(LayeredConfigurationTest::suite());
|
||||
|
@ -46,13 +46,13 @@ void ConfigurationViewTest::testView()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pView->getString("prop1") == "foo");
|
||||
assertTrue (pView->getString("prop3.string1") == "foo");
|
||||
|
||||
|
||||
pView->setString("prop6", "foobar");
|
||||
assertTrue (pConf->getString("prop6") == "foobar");
|
||||
|
||||
|
||||
pView = pConf->createView("prop1");
|
||||
pView->keys(keys);
|
||||
assertTrue (keys.empty());
|
||||
@ -66,7 +66,7 @@ void ConfigurationViewTest::testView()
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pView->getString("string1") == "foo");
|
||||
assertTrue (pView->getString("string2") == "bar");
|
||||
|
||||
@ -80,7 +80,7 @@ void ConfigurationViewTest::testView()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pView->getString("sub1.string1") == "FOO");
|
||||
assertTrue (pView->getString("sub2.string2") == "Bar");
|
||||
|
||||
@ -89,10 +89,10 @@ void ConfigurationViewTest::testView()
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pView->getString("string1") == "FOO");
|
||||
assertTrue (pView->getString("string2") == "BAR");
|
||||
|
||||
|
||||
pView->setString("string3", "foobar");
|
||||
assertTrue (pConf->getString("prop5.sub1.string3") == "foobar");
|
||||
|
||||
|
@ -36,7 +36,7 @@ FilesystemConfigurationTest::~FilesystemConfigurationTest()
|
||||
void FilesystemConfigurationTest::testFilesystemConfiguration()
|
||||
{
|
||||
AutoPtr<FilesystemConfiguration> config = new FilesystemConfiguration(_path.toString());
|
||||
|
||||
|
||||
config->setString("logging.loggers.root.channel.class", "ConsoleChannel");
|
||||
config->setString("logging.loggers.app.name", "Application");
|
||||
config->setString("logging.loggers.app.channel", "c1");
|
||||
@ -52,7 +52,7 @@ void FilesystemConfigurationTest::testFilesystemConfiguration()
|
||||
|
||||
config->setString("logging.loggers.app.channel", "c2");
|
||||
assertTrue (config->getString("logging.loggers.app.channel") == "c2");
|
||||
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
config->keys(keys);
|
||||
assertTrue (keys.size() == 1);
|
||||
@ -72,7 +72,7 @@ void FilesystemConfigurationTest::testFilesystemConfiguration()
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "class") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "pattern") != keys.end());
|
||||
|
||||
|
||||
assertTrue (config->hasProperty("logging.loggers.root.channel.class"));
|
||||
config->clear();
|
||||
assertTrue (!config->hasProperty("logging.loggers.root.channel.class"));
|
||||
|
@ -40,7 +40,7 @@ void HelpFormatterTest::testHelpFormatter()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path"));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("library-dir", "L", "specify a search path for locating library files (this option has a very long description)")
|
||||
.required(false)
|
||||
@ -56,7 +56,7 @@ void HelpFormatterTest::testHelpFormatter()
|
||||
.description("enable verbose mode")
|
||||
.required(false)
|
||||
.repeatable(false));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("optimize", "O")
|
||||
.description("enable optimization")
|
||||
@ -66,10 +66,10 @@ void HelpFormatterTest::testHelpFormatter()
|
||||
|
||||
HelpFormatter formatter(set);
|
||||
formatter.format(std::cout);
|
||||
|
||||
|
||||
formatter.setCommand("cc");
|
||||
formatter.format(std::cout);
|
||||
|
||||
|
||||
formatter.setUsage("OPTIONS FILES");
|
||||
formatter.setHeader("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
||||
"Vivamus volutpat imperdiet massa. Nulla at ipsum vitae risus facilisis posuere. "
|
||||
@ -79,10 +79,10 @@ void HelpFormatterTest::testHelpFormatter()
|
||||
"Etiam odio dolor, fermentum quis, mollis nec, sodales sed, tellus. "
|
||||
"Quisque consequat orci eu augue. Aliquam ac nibh ac neque hendrerit iaculis.");
|
||||
formatter.format(std::cout);
|
||||
|
||||
|
||||
formatter.setUnixStyle(false);
|
||||
formatter.format(std::cout);
|
||||
|
||||
|
||||
formatter.setHeader("");
|
||||
formatter.setFooter("tab: a\tb\tcde\tf\n\ta\n\t\tb");
|
||||
formatter.format(std::cout);
|
||||
|
@ -37,7 +37,7 @@ IniFileConfigurationTest::~IniFileConfigurationTest()
|
||||
|
||||
void IniFileConfigurationTest::testLoad()
|
||||
{
|
||||
static const std::string iniFile =
|
||||
static const std::string iniFile =
|
||||
"; comment\n"
|
||||
" ; comment \n"
|
||||
"prop1=value1\n"
|
||||
@ -51,10 +51,10 @@ void IniFileConfigurationTest::testLoad()
|
||||
"prop1 = value 5\n"
|
||||
"\t \n"
|
||||
"Prop2 = value6";
|
||||
|
||||
std::istringstream istr(iniFile);
|
||||
|
||||
std::istringstream istr(iniFile);
|
||||
AutoPtr<IniFileConfiguration> pConf = new IniFileConfiguration(istr);
|
||||
|
||||
|
||||
assertTrue (pConf->getString("prop1") == "value1");
|
||||
assertTrue (pConf->getString("prop2") == "value2");
|
||||
assertTrue (pConf->getString("section1.prop1") == "value3");
|
||||
@ -62,7 +62,7 @@ void IniFileConfigurationTest::testLoad()
|
||||
assertTrue (pConf->getString("section 2.prop1") == "value 5");
|
||||
assertTrue (pConf->getString("section 2.prop2") == "value6");
|
||||
assertTrue (pConf->getString("SECTION 2.PROP2") == "value6");
|
||||
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
pConf->keys(keys);
|
||||
assertTrue (keys.size() == 4);
|
||||
@ -70,12 +70,12 @@ void IniFileConfigurationTest::testLoad()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "section1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "section 2") != keys.end());
|
||||
|
||||
|
||||
pConf->keys("Section1", keys);
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
|
||||
|
||||
pConf->setString("prop1", "value11");
|
||||
assertTrue (pConf->getString("PROP1") == "value11");
|
||||
pConf->setString("Prop1", "value12");
|
||||
|
@ -113,6 +113,26 @@ void JSONConfigurationTest::testSetArrayElement()
|
||||
}
|
||||
|
||||
|
||||
void JSONConfigurationTest::testConfigurationView()
|
||||
{
|
||||
std::string json = R"json({ "foo" : [ "bar" ] })json";
|
||||
Poco::Util::JSONConfiguration config;
|
||||
std::istringstream stream(json);
|
||||
config.load(stream);
|
||||
|
||||
Poco::Util::AbstractConfiguration::Ptr pView = config.createView("foo");
|
||||
|
||||
assertTrue (pView->getString("[0]") == "bar");
|
||||
|
||||
try
|
||||
{
|
||||
pView->getString("[1]");
|
||||
fail ("must throw on index out of bounds");
|
||||
}
|
||||
catch(Poco::NotFoundException&){}
|
||||
}
|
||||
|
||||
|
||||
AbstractConfiguration::Ptr JSONConfigurationTest::allocConfiguration() const
|
||||
{
|
||||
return new JSONConfiguration;
|
||||
@ -136,6 +156,7 @@ CppUnit::Test* JSONConfigurationTest::suite()
|
||||
AbstractConfigurationTest_addTests(pSuite, JSONConfigurationTest);
|
||||
CppUnit_addTest(pSuite, JSONConfigurationTest, testLoad);
|
||||
CppUnit_addTest(pSuite, JSONConfigurationTest, testSetArrayElement);
|
||||
CppUnit_addTest(pSuite, JSONConfigurationTest, testConfigurationView);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
|
||||
void testLoad();
|
||||
void testSetArrayElement();
|
||||
void testConfigurationView();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
@ -39,11 +39,11 @@ LayeredConfigurationTest::~LayeredConfigurationTest()
|
||||
void LayeredConfigurationTest::testEmpty()
|
||||
{
|
||||
AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
|
||||
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
pLC->keys(keys);
|
||||
assertTrue (keys.empty());
|
||||
|
||||
|
||||
assertTrue (!pLC->hasProperty("foo"));
|
||||
try
|
||||
{
|
||||
@ -53,7 +53,7 @@ void LayeredConfigurationTest::testEmpty()
|
||||
catch (RuntimeException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string s = pLC->getString("foo");
|
||||
@ -69,10 +69,10 @@ void LayeredConfigurationTest::testOneLayer()
|
||||
{
|
||||
AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC = new MapConfiguration;
|
||||
|
||||
|
||||
pMC->setString("prop1", "value1");
|
||||
pMC->setString("prop2", "value2");
|
||||
|
||||
|
||||
pLC->addWriteable(pMC, 0);
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
@ -80,7 +80,7 @@ void LayeredConfigurationTest::testOneLayer()
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pLC->getString("prop1") == "value1");
|
||||
assertTrue (pLC->getString("prop2") == "value2");
|
||||
|
||||
@ -97,12 +97,12 @@ void LayeredConfigurationTest::testTwoLayers()
|
||||
AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
|
||||
|
||||
|
||||
pMC1->setString("prop1", "value1");
|
||||
pMC1->setString("prop2", "value2");
|
||||
pMC2->setString("prop2", "value3");
|
||||
pMC2->setString("prop3", "value4");
|
||||
|
||||
|
||||
pLC->add(pMC1, 0);
|
||||
pLC->addWriteable(pMC2, 1);
|
||||
|
||||
@ -112,7 +112,7 @@ void LayeredConfigurationTest::testTwoLayers()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pLC->getString("prop1") == "value1");
|
||||
assertTrue (pLC->getString("prop2") == "value2");
|
||||
assertTrue (pLC->getString("prop3") == "value4");
|
||||
@ -139,7 +139,7 @@ void LayeredConfigurationTest::testThreeLayers()
|
||||
AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC3 = new MapConfiguration;
|
||||
|
||||
|
||||
pMC1->setString("prop1", "value1");
|
||||
pMC1->setString("prop2", "value2");
|
||||
pMC1->setString("prop3", "value3");
|
||||
@ -147,11 +147,11 @@ void LayeredConfigurationTest::testThreeLayers()
|
||||
pMC2->setString("prop4", "value5");
|
||||
pMC3->setString("prop5", "value6");
|
||||
pMC3->setString("prop1", "value7");
|
||||
|
||||
|
||||
pLC->add(pMC1, 0);
|
||||
pLC->add(pMC2, 1);
|
||||
pLC->add(pMC3, -1);
|
||||
|
||||
|
||||
assertTrue (pLC->getString("prop1") == "value7");
|
||||
assertTrue (pLC->getString("prop2") == "value2");
|
||||
assertTrue (pLC->getString("prop3") == "value3");
|
||||
@ -165,12 +165,12 @@ void LayeredConfigurationTest::testRemove()
|
||||
AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
|
||||
AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
|
||||
|
||||
|
||||
pMC1->setString("prop1", "value1");
|
||||
pMC1->setString("prop2", "value2");
|
||||
pMC2->setString("prop2", "value3");
|
||||
pMC2->setString("prop3", "value4");
|
||||
|
||||
|
||||
pLC->add(pMC1, 0);
|
||||
pLC->add(pMC2, -1);
|
||||
|
||||
@ -181,7 +181,7 @@ void LayeredConfigurationTest::testRemove()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
|
||||
|
||||
|
||||
assertTrue (pLC->getString("prop1") == "value1");
|
||||
assertTrue (pLC->getString("prop2") == "value3");
|
||||
assertTrue (pLC->getString("prop3") == "value4");
|
||||
@ -201,13 +201,13 @@ void LayeredConfigurationTest::testFind()
|
||||
LayeredConfiguration::Ptr pLC = new LayeredConfiguration;
|
||||
AbstractConfiguration::Ptr pMC1 = new MapConfiguration;
|
||||
AbstractConfiguration::Ptr pMC2 = new MapConfiguration;
|
||||
|
||||
|
||||
pLC->add(pMC1, 0);
|
||||
pLC->add(pMC2, "label", -1);
|
||||
|
||||
|
||||
AbstractConfiguration::Ptr pFound = pLC->find("label");
|
||||
assertTrue (pFound == pMC2);
|
||||
|
||||
|
||||
pFound = pLC->find("notfound");
|
||||
assertTrue (pFound.isNull());
|
||||
}
|
||||
|
114
vendor/POCO/Util/testsuite/src/LocalConfigurationViewTest.cpp
vendored
Normal file
114
vendor/POCO/Util/testsuite/src/LocalConfigurationViewTest.cpp
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
//
|
||||
// LocalConfigurationViewTest.cpp
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
#include "LocalConfigurationViewTest.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Util/MapConfiguration.h"
|
||||
|
||||
using Poco::AutoPtr;
|
||||
using Poco::Util::AbstractConfiguration;
|
||||
using Poco::Util::MapConfiguration;
|
||||
|
||||
LocalConfigurationViewTest::LocalConfigurationViewTest(const std::string& name) : AbstractConfigurationTest(name) {
|
||||
}
|
||||
|
||||
LocalConfigurationViewTest::~LocalConfigurationViewTest() {
|
||||
}
|
||||
|
||||
void LocalConfigurationViewTest::testLocalView() {
|
||||
AbstractConfiguration::Ptr pConf = createConfiguration();
|
||||
AbstractConfiguration::Ptr pView = pConf->createLocalView("");
|
||||
assertTrue(pView->hasProperty("prop1"));
|
||||
assertTrue(pView->hasProperty("prop2"));
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
pView->keys(keys);
|
||||
assertTrue(keys.size() == 13);
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "prop1") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "prop2") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "prop3") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "prop4") != keys.end());
|
||||
|
||||
assertTrue(pView->getString("prop1") == "foo");
|
||||
assertTrue(pView->getString("prop3.string1") == "foo");
|
||||
|
||||
pView->setString("prop6", "foobar");
|
||||
assertTrue(pConf->getString("prop6") == "foobar");
|
||||
|
||||
pView = pConf->createLocalView("prop1");
|
||||
pView->keys(keys);
|
||||
assertTrue(keys.empty());
|
||||
assertFalse(pView->hasProperty("prop1"));
|
||||
|
||||
pView->setString("prop11", "foobar");
|
||||
assertTrue(pConf->getString("prop1.prop11") == "foobar");
|
||||
|
||||
pView = pConf->createLocalView("prop3");
|
||||
pView->keys(keys);
|
||||
assertTrue(keys.size() == 2);
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
|
||||
assertTrue(pView->getString("string1") == "foo");
|
||||
assertTrue(pView->getString("string2") == "bar");
|
||||
|
||||
pView->setString("string3", "foobar");
|
||||
assertTrue(pConf->getString("prop3.string3") == "foobar");
|
||||
|
||||
pView = pConf->createLocalView("prop5");
|
||||
pView->keys(keys);
|
||||
assertTrue(keys.size() == 4);
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "sub1") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "sub2") != keys.end());
|
||||
|
||||
assertTrue(pView->getString("sub1.string1") == "FOO");
|
||||
assertTrue(pView->getString("sub2.string2") == "Bar");
|
||||
|
||||
pView = pConf->createLocalView("prop5.sub1");
|
||||
pView->keys(keys);
|
||||
assertTrue(keys.size() == 2);
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "string1") != keys.end());
|
||||
assertTrue(std::find(keys.begin(), keys.end(), "string2") != keys.end());
|
||||
|
||||
assertTrue(pView->getString("string1") == "FOO");
|
||||
assertTrue(pView->getString("string2") == "BAR");
|
||||
|
||||
pView->setString("string3", "foobar");
|
||||
assertTrue(pConf->getString("prop5.sub1.string3") == "foobar");
|
||||
|
||||
pView->remove("string3");
|
||||
assertTrue(!pConf->hasProperty("prop5.sub1.string3"));
|
||||
}
|
||||
|
||||
AbstractConfiguration::Ptr LocalConfigurationViewTest::allocConfiguration() const {
|
||||
return new MapConfiguration;
|
||||
}
|
||||
|
||||
void LocalConfigurationViewTest::setUp() {
|
||||
}
|
||||
|
||||
void LocalConfigurationViewTest::tearDown() {
|
||||
}
|
||||
|
||||
CppUnit::Test* LocalConfigurationViewTest::suite() {
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("LocalConfigurationViewTest");
|
||||
|
||||
AbstractConfigurationTest_addTests(pSuite, LocalConfigurationViewTest);
|
||||
CppUnit_addTest(pSuite, LocalConfigurationViewTest, testLocalView);
|
||||
|
||||
return pSuite;
|
||||
}
|
34
vendor/POCO/Util/testsuite/src/LocalConfigurationViewTest.h
vendored
Normal file
34
vendor/POCO/Util/testsuite/src/LocalConfigurationViewTest.h
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// LocalConfigurationViewTest.h
|
||||
//
|
||||
// Definition of the ConfigurationViewTest class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
#ifndef LocalConfigurationViewTest_INCLUDED
|
||||
#define LocalConfigurationViewTest_INCLUDED
|
||||
|
||||
#include "AbstractConfigurationTest.h"
|
||||
#include "Poco/Util/Util.h"
|
||||
|
||||
class LocalConfigurationViewTest : public AbstractConfigurationTest {
|
||||
public:
|
||||
LocalConfigurationViewTest(const std::string& name);
|
||||
virtual ~LocalConfigurationViewTest();
|
||||
|
||||
void testLocalView();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
virtual Poco::Util::AbstractConfiguration::Ptr allocConfiguration() const;
|
||||
};
|
||||
|
||||
#endif // LocalConfigurationViewTest_INCLUDED
|
@ -84,7 +84,7 @@ void LoggingConfiguratorTest::testConfigurator()
|
||||
|
||||
LoggingConfigurator configurator;
|
||||
configurator.configure(pConfig);
|
||||
|
||||
|
||||
Logger& root = Logger::get("");
|
||||
assertTrue (root.getLevel() == Message::PRIO_WARNING);
|
||||
FormattingChannel::Ptr pFC = root.getChannel().cast<FormattingChannel>();
|
||||
@ -96,7 +96,7 @@ void LoggingConfiguratorTest::testConfigurator()
|
||||
#endif
|
||||
assertTrue (!pFC->getFormatter().cast<Poco::PatternFormatter>().isNull());
|
||||
assertTrue ((pFC->getFormatter().cast<PatternFormatter>())->getProperty("pattern") == "%s-[%p] %t");
|
||||
|
||||
|
||||
Logger& logger1 = Logger::get("logger1");
|
||||
assertTrue (logger1.getLevel() == Message::PRIO_INFORMATION);
|
||||
pFC = logger1.getChannel().cast<FormattingChannel>();
|
||||
@ -113,9 +113,9 @@ void LoggingConfiguratorTest::testConfigurator()
|
||||
|
||||
void LoggingConfiguratorTest::testBadConfiguration1()
|
||||
{
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// a bad configuration.
|
||||
|
||||
|
||||
static const std::string config =
|
||||
"logging.loggers.root.channel = c1\n"
|
||||
"logging.loggers.root.level = warning\n"
|
||||
@ -156,9 +156,9 @@ void LoggingConfiguratorTest::testBadConfiguration1()
|
||||
|
||||
void LoggingConfiguratorTest::testBadConfiguration2()
|
||||
{
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// a bad configuration.
|
||||
|
||||
|
||||
static const std::string config =
|
||||
"logging.loggers.root.channel = c1\n"
|
||||
"logging.loggers.root.level = unknown\n"
|
||||
@ -199,9 +199,9 @@ void LoggingConfiguratorTest::testBadConfiguration2()
|
||||
|
||||
void LoggingConfiguratorTest::testBadConfiguration3()
|
||||
{
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// a bad configuration.
|
||||
|
||||
|
||||
static const std::string config =
|
||||
"logging.loggers.root.channel = c1\n"
|
||||
"logging.loggers.root.level = warning\n"
|
||||
@ -242,9 +242,9 @@ void LoggingConfiguratorTest::testBadConfiguration3()
|
||||
|
||||
void LoggingConfiguratorTest::testBadConfiguration4()
|
||||
{
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// this is mainly testing for memory leaks in case of
|
||||
// a bad configuration.
|
||||
|
||||
|
||||
static const std::string config =
|
||||
"logging.loggers.root.channel = c1\n"
|
||||
"logging.loggers.root.level = warning\n"
|
||||
|
@ -33,10 +33,10 @@ MapConfigurationTest::~MapConfigurationTest()
|
||||
void MapConfigurationTest::testClear()
|
||||
{
|
||||
AutoPtr<MapConfiguration> pConf = new MapConfiguration;
|
||||
|
||||
|
||||
pConf->setString("foo", "bar");
|
||||
assertTrue (pConf->hasProperty("foo"));
|
||||
|
||||
|
||||
pConf->clear();
|
||||
assertTrue (!pConf->hasProperty("foo"));
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ void OptionProcessorTest::testUnix()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path"));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("library-dir", "L", "specify a search path for locating library files")
|
||||
.required(false)
|
||||
@ -56,7 +56,7 @@ void OptionProcessorTest::testUnix()
|
||||
.description("enable verbose mode")
|
||||
.required(false)
|
||||
.repeatable(false));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("optimize", "O")
|
||||
.description("enable optimization")
|
||||
@ -64,7 +64,7 @@ void OptionProcessorTest::testUnix()
|
||||
.repeatable(false)
|
||||
.argument("level", false)
|
||||
.group("mode"));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("debug", "g")
|
||||
.description("generate debug information")
|
||||
@ -81,7 +81,7 @@ void OptionProcessorTest::testUnix()
|
||||
OptionProcessor p1(set);
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
|
||||
assertTrue (p1.process("-I/usr/include", name, value));
|
||||
assertTrue (name == "include-dir");
|
||||
assertTrue (value == "/usr/include");
|
||||
@ -89,7 +89,7 @@ void OptionProcessorTest::testUnix()
|
||||
assertTrue (p1.process("--include:/usr/local/include", name, value));
|
||||
assertTrue (name == "include-dir");
|
||||
assertTrue (value == "/usr/local/include");
|
||||
|
||||
|
||||
assertTrue (p1.process("-I", name, value));
|
||||
assertTrue (name.empty());
|
||||
assertTrue (value.empty());
|
||||
@ -107,14 +107,14 @@ void OptionProcessorTest::testUnix()
|
||||
assertTrue (p1.process("--lib=/usr/local/lib", name, value));
|
||||
assertTrue (name == "library-dir");
|
||||
assertTrue (value == "/usr/local/lib");
|
||||
|
||||
|
||||
assertTrue (p1.process("-ofile", name, value));
|
||||
assertTrue (name == "output");
|
||||
assertTrue (value == "file");
|
||||
|
||||
|
||||
assertTrue (!p1.process("src/file.cpp", name, value));
|
||||
assertTrue (!p1.process("/src/file.cpp", name, value));
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.process("--output:file", name, value);
|
||||
@ -123,11 +123,11 @@ void OptionProcessorTest::testUnix()
|
||||
catch (Poco::Util::DuplicateOptionException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (p1.process("-g", name, value));
|
||||
assertTrue (name == "debug");
|
||||
assertTrue (value == "");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.process("--optimize", name, value);
|
||||
@ -136,7 +136,7 @@ void OptionProcessorTest::testUnix()
|
||||
catch (Poco::Util::IncompatibleOptionsException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.process("-x", name, value);
|
||||
@ -165,7 +165,7 @@ void OptionProcessorTest::testDefault()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path"));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("library-dir", "L", "specify a search path for locating library files")
|
||||
.required(false)
|
||||
@ -181,7 +181,7 @@ void OptionProcessorTest::testDefault()
|
||||
.description("enable verbose mode")
|
||||
.required(false)
|
||||
.repeatable(false));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("optimize", "O")
|
||||
.description("enable optimization")
|
||||
@ -189,7 +189,7 @@ void OptionProcessorTest::testDefault()
|
||||
.repeatable(false)
|
||||
.argument("level", false)
|
||||
.group("mode"));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("debug", "g")
|
||||
.description("generate debug information")
|
||||
@ -207,7 +207,7 @@ void OptionProcessorTest::testDefault()
|
||||
p1.setUnixStyle(false);
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
|
||||
assertTrue (p1.process("/Inc:/usr/include", name, value));
|
||||
assertTrue (name == "include-dir");
|
||||
assertTrue (value == "/usr/include");
|
||||
@ -226,14 +226,14 @@ void OptionProcessorTest::testDefault()
|
||||
assertTrue (p1.process("/lib=/usr/local/lib", name, value));
|
||||
assertTrue (name == "library-dir");
|
||||
assertTrue (value == "/usr/local/lib");
|
||||
|
||||
|
||||
assertTrue (p1.process("/out:file", name, value));
|
||||
assertTrue (name == "output");
|
||||
assertTrue (value == "file");
|
||||
|
||||
|
||||
assertTrue (!p1.process("src/file.cpp", name, value));
|
||||
assertTrue (!p1.process("\\src\\file.cpp", name, value));
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.process("/output:file", name, value);
|
||||
@ -242,11 +242,11 @@ void OptionProcessorTest::testDefault()
|
||||
catch (Poco::Util::DuplicateOptionException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (p1.process("/debug", name, value));
|
||||
assertTrue (name == "debug");
|
||||
assertTrue (value == "");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.process("/OPT", name, value);
|
||||
@ -255,7 +255,7 @@ void OptionProcessorTest::testDefault()
|
||||
catch (Poco::Util::IncompatibleOptionsException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.process("/x", name, value);
|
||||
@ -287,7 +287,7 @@ void OptionProcessorTest::testRequired()
|
||||
OptionProcessor p1(set);
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
p1.checkRequired();
|
||||
@ -296,7 +296,7 @@ void OptionProcessorTest::testRequired()
|
||||
catch (Poco::Util::MissingOptionException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
assertTrue (p1.process("-o", name, value));
|
||||
p1.checkRequired();
|
||||
}
|
||||
@ -310,7 +310,7 @@ void OptionProcessorTest::testArgs()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path"));
|
||||
|
||||
|
||||
set.addOption(
|
||||
Option("optimize", "O")
|
||||
.description("enable optimization")
|
||||
@ -321,7 +321,7 @@ void OptionProcessorTest::testArgs()
|
||||
OptionProcessor p1(set);
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
|
||||
assertTrue (p1.process("-I/usr/include", name, value));
|
||||
assertTrue (name == "include-dir");
|
||||
assertTrue (value == "/usr/include");
|
||||
@ -329,7 +329,7 @@ void OptionProcessorTest::testArgs()
|
||||
assertTrue (p1.process("--include:/usr/local/include", name, value));
|
||||
assertTrue (name == "include-dir");
|
||||
assertTrue (value == "/usr/local/include");
|
||||
|
||||
|
||||
assertTrue (p1.process("-I", name, value));
|
||||
assertTrue (name.empty());
|
||||
assertTrue (value.empty());
|
||||
@ -347,7 +347,7 @@ void OptionProcessorTest::testArgs()
|
||||
assertTrue (p1.process("-O", name, value));
|
||||
assertTrue (name == "optimize");
|
||||
assertTrue (value.empty());
|
||||
|
||||
|
||||
assertTrue (p1.process("-O2", name, value));
|
||||
assertTrue (name == "optimize");
|
||||
assertTrue (value == "2");
|
||||
|
@ -66,7 +66,7 @@ void OptionSetTest::testOptionSet()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path"));
|
||||
|
||||
|
||||
assertTrue (set.hasOption("include", false));
|
||||
assertTrue (set.hasOption("I", true));
|
||||
assertTrue (set.hasOption("Include", true));
|
||||
@ -76,12 +76,12 @@ void OptionSetTest::testOptionSet()
|
||||
assertTrue (set.hasOption("item", false));
|
||||
assertTrue (!set.hasOption("i", false));
|
||||
assertTrue (!set.hasOption("in", false));
|
||||
|
||||
|
||||
assertTrue (set.hasOption("help"));
|
||||
assertTrue (set.hasOption("h", true));
|
||||
assertTrue (set.hasOption("helper"));
|
||||
assertTrue (set.hasOption("H", true));
|
||||
|
||||
|
||||
const Option& opt1 = set.getOption("include");
|
||||
assertTrue (opt1.fullName() == "include");
|
||||
|
||||
@ -99,7 +99,7 @@ void OptionSetTest::testOptionSet()
|
||||
|
||||
const Option& opt6 = set.getOption("helpe");
|
||||
assertTrue (opt6.fullName() == "helper");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
set.getOption("in");
|
||||
|
48
vendor/POCO/Util/testsuite/src/OptionTest.cpp
vendored
48
vendor/POCO/Util/testsuite/src/OptionTest.cpp
vendored
@ -34,11 +34,11 @@ void OptionTest::testOption()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path");
|
||||
|
||||
|
||||
Option libOpt = Option("library-dir", "L", "specify a library search path", false)
|
||||
.repeatable(true)
|
||||
.argument("path");
|
||||
|
||||
|
||||
Option outOpt = Option("output", "o", "specify the output file", true)
|
||||
.argument("file", true);
|
||||
|
||||
@ -46,13 +46,13 @@ void OptionTest::testOption()
|
||||
.description("enable verbose mode")
|
||||
.required(false)
|
||||
.repeatable(false);
|
||||
|
||||
|
||||
Option optOpt = Option("optimize", "O")
|
||||
.description("enable optimization")
|
||||
.required(false)
|
||||
.repeatable(false)
|
||||
.argument("level", false);
|
||||
|
||||
|
||||
assertTrue (incOpt.shortName() == "I");
|
||||
assertTrue (incOpt.fullName() == "include-dir");
|
||||
assertTrue (incOpt.repeatable());
|
||||
@ -60,7 +60,7 @@ void OptionTest::testOption()
|
||||
assertTrue (incOpt.argumentName() == "path");
|
||||
assertTrue (incOpt.argumentRequired());
|
||||
assertTrue (incOpt.takesArgument());
|
||||
|
||||
|
||||
assertTrue (libOpt.shortName() == "L");
|
||||
assertTrue (libOpt.fullName() == "library-dir");
|
||||
assertTrue (libOpt.repeatable());
|
||||
@ -100,7 +100,7 @@ void OptionTest::testMatches1()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path");
|
||||
|
||||
|
||||
assertTrue (incOpt.matchesShort("Iinclude"));
|
||||
assertTrue (incOpt.matchesPartial("include:include"));
|
||||
assertTrue (incOpt.matchesPartial("include-dir:include"));
|
||||
@ -109,12 +109,12 @@ void OptionTest::testMatches1()
|
||||
assertTrue (incOpt.matchesPartial("include"));
|
||||
assertTrue (incOpt.matchesShort("I"));
|
||||
assertTrue (incOpt.matchesPartial("i"));
|
||||
|
||||
|
||||
assertTrue (incOpt.matchesFull("include-dir:include"));
|
||||
assertTrue (incOpt.matchesFull("INClude-dir:include"));
|
||||
assertTrue (!incOpt.matchesFull("include:include"));
|
||||
assertTrue (!incOpt.matchesFull("include-dir2:include"));
|
||||
|
||||
|
||||
assertTrue (!incOpt.matchesPartial("include-dir2=include"));
|
||||
assertTrue (!incOpt.matchesShort("linclude"));
|
||||
}
|
||||
@ -126,7 +126,7 @@ void OptionTest::testMatches2()
|
||||
.required(false)
|
||||
.repeatable(true)
|
||||
.argument("path");
|
||||
|
||||
|
||||
assertTrue (!incOpt.matchesShort("Iinclude"));
|
||||
assertTrue (incOpt.matchesPartial("include:include"));
|
||||
assertTrue (incOpt.matchesPartial("include-dir:include"));
|
||||
@ -134,12 +134,12 @@ void OptionTest::testMatches2()
|
||||
assertTrue (incOpt.matchesPartial("INCLUDE=include"));
|
||||
assertTrue (incOpt.matchesPartial("I"));
|
||||
assertTrue (incOpt.matchesPartial("i"));
|
||||
|
||||
|
||||
assertTrue (incOpt.matchesFull("include-dir:include"));
|
||||
assertTrue (incOpt.matchesFull("INClude-dir:include"));
|
||||
assertTrue (!incOpt.matchesFull("include:include"));
|
||||
assertTrue (!incOpt.matchesFull("include-dir2:include"));
|
||||
|
||||
|
||||
assertTrue (!incOpt.matchesFull("include-dir2=include"));
|
||||
assertTrue (!incOpt.matchesShort("linclude"));
|
||||
}
|
||||
@ -165,7 +165,7 @@ void OptionTest::testProcess1()
|
||||
assertTrue (arg == "/usr/include");
|
||||
incOpt.process("Include-dir:/proj/include", arg);
|
||||
assertTrue (arg == "/proj/include");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
incOpt.process("I", arg);
|
||||
@ -183,7 +183,7 @@ void OptionTest::testProcess1()
|
||||
catch (Poco::Util::MissingArgumentException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
incOpt.process("Llib", arg);
|
||||
@ -192,17 +192,17 @@ void OptionTest::testProcess1()
|
||||
catch (Poco::Util::UnknownOptionException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Option vrbOpt = Option("verbose", "v")
|
||||
.description("enable verbose mode")
|
||||
.required(false)
|
||||
.repeatable(false);
|
||||
|
||||
|
||||
vrbOpt.process("v", arg);
|
||||
assertTrue (arg.empty());
|
||||
vrbOpt.process("verbose", arg);
|
||||
assertTrue (arg.empty());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
vrbOpt.process("v2", arg);
|
||||
@ -220,13 +220,13 @@ void OptionTest::testProcess1()
|
||||
catch (Poco::Util::UnexpectedArgumentException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Option optOpt = Option("optimize", "O")
|
||||
.description("enable optimization")
|
||||
.required(false)
|
||||
.repeatable(false)
|
||||
.argument("level", false);
|
||||
|
||||
|
||||
optOpt.process("O", arg);
|
||||
assertTrue (arg.empty());
|
||||
optOpt.process("O2", arg);
|
||||
@ -258,7 +258,7 @@ void OptionTest::testProcess2()
|
||||
assertTrue (arg == "/usr/include");
|
||||
incOpt.process("Include-dir:/proj/include", arg);
|
||||
assertTrue (arg == "/proj/include");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
incOpt.process("Iinclude", arg);
|
||||
@ -267,7 +267,7 @@ void OptionTest::testProcess2()
|
||||
catch (Poco::Util::UnknownOptionException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
incOpt.process("I", arg);
|
||||
@ -285,7 +285,7 @@ void OptionTest::testProcess2()
|
||||
catch (Poco::Util::MissingArgumentException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
incOpt.process("Llib", arg);
|
||||
@ -294,17 +294,17 @@ void OptionTest::testProcess2()
|
||||
catch (Poco::Util::UnknownOptionException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Option vrbOpt = Option("verbose", "")
|
||||
.description("enable verbose mode")
|
||||
.required(false)
|
||||
.repeatable(false);
|
||||
|
||||
|
||||
vrbOpt.process("v", arg);
|
||||
assertTrue (arg.empty());
|
||||
vrbOpt.process("verbose", arg);
|
||||
assertTrue (arg.empty());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
vrbOpt.process("v2", arg);
|
||||
|
@ -36,7 +36,7 @@ PropertyFileConfigurationTest::~PropertyFileConfigurationTest()
|
||||
|
||||
void PropertyFileConfigurationTest::testLoad()
|
||||
{
|
||||
static const std::string propFile =
|
||||
static const std::string propFile =
|
||||
"! comment\n"
|
||||
"! comment\n"
|
||||
"prop1=value1\n"
|
||||
@ -50,10 +50,10 @@ void PropertyFileConfigurationTest::testLoad()
|
||||
"prop4 = escaped[\\t\\r\\n\\f]\n"
|
||||
"#prop4 = foo\n"
|
||||
"prop5:foo";
|
||||
|
||||
|
||||
std::istringstream istr(propFile);
|
||||
AutoPtr<PropertyFileConfiguration> pConf = new PropertyFileConfiguration(istr);
|
||||
|
||||
|
||||
assertTrue (pConf->getString("prop1") == "value1");
|
||||
assertTrue (pConf->getString("prop2") == "value2");
|
||||
assertTrue (pConf->getString("prop3.prop31") == "value3");
|
||||
@ -61,7 +61,7 @@ void PropertyFileConfigurationTest::testLoad()
|
||||
assertTrue (pConf->getString("prop3.prop33") == "value5, value6, value7, value8, value9");
|
||||
assertTrue (pConf->getString("prop4") == "escaped[\t\r\n\f]");
|
||||
assertTrue (pConf->getString("prop5") == "foo");
|
||||
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
pConf->keys(keys);
|
||||
assertTrue (keys.size() == 5);
|
||||
@ -70,13 +70,13 @@ void PropertyFileConfigurationTest::testLoad()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop5") != keys.end());
|
||||
|
||||
|
||||
pConf->keys("prop3", keys);
|
||||
assertTrue (keys.size() == 3);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop31") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop32") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop33") != keys.end());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string s = pConf->getString("foo");
|
||||
@ -91,11 +91,11 @@ void PropertyFileConfigurationTest::testLoad()
|
||||
void PropertyFileConfigurationTest::testSave()
|
||||
{
|
||||
AutoPtr<PropertyFileConfiguration> pConf = new PropertyFileConfiguration;
|
||||
|
||||
|
||||
pConf->setString("prop1", "value1");
|
||||
pConf->setInt("prop2", 42);
|
||||
pConf->setString("prop3", "value\\1\txxx");
|
||||
|
||||
|
||||
std::ostringstream ostr;
|
||||
pConf->save(ostr);
|
||||
std::string propFile = ostr.str();
|
||||
|
@ -45,7 +45,7 @@ SystemConfigurationTest::~SystemConfigurationTest()
|
||||
void SystemConfigurationTest::testProperties()
|
||||
{
|
||||
AutoPtr<SystemConfiguration> pConf = new SystemConfiguration;
|
||||
|
||||
|
||||
assertTrue (pConf->getString("system.osName") == Environment::osName());
|
||||
assertTrue (pConf->getString("system.osVersion") == Environment::osVersion());
|
||||
assertTrue (pConf->getString("system.osArchitecture") == Environment::osArchitecture());
|
||||
@ -53,15 +53,15 @@ void SystemConfigurationTest::testProperties()
|
||||
assertTrue (pConf->getString("system.currentDir") == Path::current());
|
||||
assertTrue (pConf->getString("system.homeDir") == Path::home());
|
||||
assertTrue (pConf->getString("system.tempDir") == Path::temp());
|
||||
|
||||
|
||||
std::string dateTime = pConf->getString("system.dateTime");
|
||||
assertTrue (dateTime.size() == 20);
|
||||
|
||||
|
||||
#if !defined(POCO_VXWORKS)
|
||||
std::string pid = pConf->getString("system.pid");
|
||||
assertTrue (Poco::NumberParser::parse64(pid) == Poco::Process::id());
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
std::string home = pConf->getString("system.env.HOMEPATH");
|
||||
#else
|
||||
|
32
vendor/POCO/Util/testsuite/src/TimerTest.cpp
vendored
32
vendor/POCO/Util/testsuite/src/TimerTest.cpp
vendored
@ -260,11 +260,40 @@ void TimerTest::testCancelAllWaitStop()
|
||||
}
|
||||
|
||||
|
||||
void TimerTest::testMultiCancelAllWaitStop()
|
||||
{
|
||||
Timer timer;
|
||||
|
||||
// We will schedule a task and wait for it to start.
|
||||
// After that we will schedule 2 cancel Notifications, one async and the other sync.
|
||||
// But we want to make sure that both are scheduled and present in internal queue, thus we need to wait for this
|
||||
// first task to start.
|
||||
Poco::Event startEvent;
|
||||
Poco::Event canceledScheduledEvent;
|
||||
timer.schedule(Timer::func([&startEvent, &canceledScheduledEvent]()
|
||||
{
|
||||
startEvent.set();
|
||||
canceledScheduledEvent.wait();
|
||||
Poco::Thread::sleep(100);
|
||||
}), Poco::Clock());
|
||||
// We wait for simple task to start.
|
||||
startEvent.wait();
|
||||
// Schedule async cancel notification.
|
||||
timer.cancel();
|
||||
// Now allow simple task to proceed to sleep, in other words give time for next cancel to block.
|
||||
canceledScheduledEvent.set();
|
||||
// Schedule sync cancel, now we should have 2 cancel notifications in internal queue.
|
||||
timer.cancel(true);
|
||||
|
||||
assertTrue (true); // don't hang
|
||||
}
|
||||
|
||||
|
||||
void TimerTest::testFunc()
|
||||
{
|
||||
Timer timer;
|
||||
|
||||
int count = 0;
|
||||
std::atomic<int> count(0);
|
||||
timer.schedule(Timer::func([&count]()
|
||||
{
|
||||
count++;
|
||||
@ -305,6 +334,7 @@ CppUnit::Test* TimerTest::suite()
|
||||
CppUnit_addTest(pSuite, TimerTest, testCancel);
|
||||
CppUnit_addTest(pSuite, TimerTest, testCancelAllStop);
|
||||
CppUnit_addTest(pSuite, TimerTest, testCancelAllWaitStop);
|
||||
CppUnit_addTest(pSuite, TimerTest, testMultiCancelAllWaitStop);
|
||||
CppUnit_addTest(pSuite, TimerTest, testFunc);
|
||||
|
||||
return pSuite;
|
||||
|
1
vendor/POCO/Util/testsuite/src/TimerTest.h
vendored
1
vendor/POCO/Util/testsuite/src/TimerTest.h
vendored
@ -35,6 +35,7 @@ public:
|
||||
void testCancel();
|
||||
void testCancelAllStop();
|
||||
void testCancelAllWaitStop();
|
||||
void testMultiCancelAllWaitStop();
|
||||
void testFunc();
|
||||
|
||||
void setUp();
|
||||
|
@ -40,7 +40,7 @@ void ValidatorTest::testRegExpValidator()
|
||||
{
|
||||
Option option("option", "o");
|
||||
AutoPtr<Validator> pVal(new RegExpValidator("[0-9]+"));
|
||||
|
||||
|
||||
pVal->validate(option, "0");
|
||||
pVal->validate(option, "12345");
|
||||
|
||||
@ -94,11 +94,11 @@ void ValidatorTest::testIntValidator()
|
||||
{
|
||||
Option option("option", "o");
|
||||
AutoPtr<Validator> pVal(new IntValidator(0, 100));
|
||||
|
||||
|
||||
pVal->validate(option, "0");
|
||||
pVal->validate(option, "100");
|
||||
pVal->validate(option, "55");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pVal->validate(option, "-1");
|
||||
|
@ -24,7 +24,7 @@ int wmain(int argc, wchar_t* argv[])
|
||||
std::wcstombs(buffer, argv[i], sizeof(buffer));
|
||||
args.push_back(std::string(buffer));
|
||||
}
|
||||
CppUnit::TestRunner runner;
|
||||
CppUnit::TestRunner runner;
|
||||
runner.addTest("UtilTestSuite", UtilTestSuite::suite());
|
||||
return runner.run(args) ? 0 : 1;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void WinConfigurationTest::testConfiguration()
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
pReg->setUInt64("name2", std::numeric_limits<UInt64>::max()); // overwrite should also change type
|
||||
assertTrue (pReg->getUInt64("name2") == std::numeric_limits<UInt64>::max());
|
||||
pReg->setInt64("name2", std::numeric_limits<Int64>::min());
|
||||
pReg->setInt64("name2", std::numeric_limits<Int64>::min());
|
||||
assertTrue (pReg->getInt64("name2") == std::numeric_limits<Int64>::min());
|
||||
|
||||
/// write real int64 value type
|
||||
@ -75,14 +75,14 @@ void WinConfigurationTest::testConfiguration()
|
||||
|
||||
assertTrue (pReg->hasProperty("name1"));
|
||||
assertTrue (pReg->hasProperty("name2"));
|
||||
|
||||
|
||||
std::string dfl = pReg->getString("nonexistent", "default");
|
||||
assertTrue (dfl == "default");
|
||||
|
||||
|
||||
AutoPtr<Poco::Util::AbstractConfiguration> pView = pReg->createView("config");
|
||||
dfl = pView->getString("sub.foo", "default");
|
||||
assertTrue (dfl == "default");
|
||||
|
||||
|
||||
pView->setString("sub.foo", "bar");
|
||||
assertTrue (pView->getString("sub.foo", "default") == "bar");
|
||||
|
||||
|
@ -52,7 +52,7 @@ void WinRegistryTest::testRegistry()
|
||||
assertTrue (regKey.exists("name1"));
|
||||
assertTrue (regKey.exists("name2"));
|
||||
assertTrue (regKey.exists());
|
||||
|
||||
|
||||
WinRegistryKey regKeyRO("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test", true);
|
||||
assertTrue (regKeyRO.getString("name1") == "Value1");
|
||||
try
|
||||
@ -64,7 +64,7 @@ void WinRegistryTest::testRegistry()
|
||||
std::string msg = exc.displayText();
|
||||
}
|
||||
assertTrue (regKey.getString("name1") == "Value1");
|
||||
|
||||
|
||||
WinRegistryKey::Values vals;
|
||||
regKey.values(vals);
|
||||
assertTrue (vals.size() == 2);
|
||||
@ -75,14 +75,14 @@ void WinRegistryTest::testRegistry()
|
||||
Environment::set("FOO", "bar");
|
||||
regKey.setStringExpand("name3", "%FOO%");
|
||||
assertTrue (regKey.getStringExpand("name3") == "bar");
|
||||
|
||||
|
||||
regKey.setInt("name4", 42);
|
||||
assertTrue (regKey.getInt("name4") == 42);
|
||||
|
||||
|
||||
assertTrue (regKey.exists("name4"));
|
||||
regKey.deleteValue("name4");
|
||||
assertTrue (!regKey.exists("name4"));
|
||||
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
regKey.setInt64("name5", std::numeric_limits<Int64>::max());
|
||||
assertTrue (regKey.getInt64("name5") == std::numeric_limits<Int64>::max());
|
||||
|
@ -6,17 +6,17 @@
|
||||
using Poco::Util::WinService;
|
||||
|
||||
|
||||
WinServiceTest::WinServiceTest(const std::string& name) : CppUnit::TestCase(name)
|
||||
WinServiceTest::WinServiceTest(const std::string& name) : CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WinServiceTest::~WinServiceTest()
|
||||
WinServiceTest::~WinServiceTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void WinServiceTest::testServiceCouldCreatedWithExistingConnection()
|
||||
void WinServiceTest::testServiceCouldCreatedWithExistingConnection()
|
||||
{
|
||||
SC_HANDLE scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
@ -24,7 +24,7 @@ void WinServiceTest::testServiceCouldCreatedWithExistingConnection()
|
||||
|
||||
WinService spoolerService{scmHandle, "Spooler"};
|
||||
|
||||
assertTrue(spoolerService.isRegistered());
|
||||
assertTrue(spoolerService.isRegistered());
|
||||
}
|
||||
|
||||
|
||||
@ -37,25 +37,25 @@ void WinServiceTest::testServiceReturnsTrueIfStopped()
|
||||
}
|
||||
|
||||
|
||||
void WinServiceTest::testServiceReturnsFailureActionConfigured()
|
||||
void WinServiceTest::testServiceReturnsFailureActionConfigured()
|
||||
{
|
||||
WinService spoolerService{"Spooler"};
|
||||
|
||||
auto failureActions = spoolerService.getFailureActions();
|
||||
assertEqual(3, static_cast<int>(failureActions.size()));
|
||||
|
||||
assertEqual(WinService::SVC_RESTART, failureActions[0]);
|
||||
assertEqual(WinService::SVC_RESTART, failureActions[1]);
|
||||
assertEqual(WinService::SVC_NONE, failureActions[2]);
|
||||
assertTrue(WinService::SVC_RESTART == failureActions[0]);
|
||||
assertTrue(WinService::SVC_RESTART == failureActions[1]);
|
||||
assertTrue(WinService::SVC_NONE == failureActions[2]);
|
||||
}
|
||||
|
||||
|
||||
void WinServiceTest::setUp()
|
||||
void WinServiceTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void WinServiceTest::tearDown()
|
||||
void WinServiceTest::tearDown()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ XMLConfigurationTest::~XMLConfigurationTest()
|
||||
|
||||
void XMLConfigurationTest::testLoad()
|
||||
{
|
||||
static const std::string xmlFile =
|
||||
static const std::string xmlFile =
|
||||
"<config>"
|
||||
" <prop1>value1</prop1>"
|
||||
" <prop2>value2</prop2>"
|
||||
@ -54,10 +54,10 @@ void XMLConfigurationTest::testLoad()
|
||||
" <prop7>value8</prop7>"
|
||||
" </prop6>"
|
||||
"</config>";
|
||||
|
||||
std::istringstream istr(xmlFile);
|
||||
|
||||
std::istringstream istr(xmlFile);
|
||||
AutoPtr<XMLConfiguration> pConf = new XMLConfiguration(istr);
|
||||
|
||||
|
||||
assertTrue (pConf->getString("prop1") == "value1");
|
||||
assertTrue (pConf->getString("prop2") == "value2");
|
||||
assertTrue (pConf->getString("prop3.prop4[@attr]") == "value3");
|
||||
@ -69,7 +69,7 @@ void XMLConfigurationTest::testLoad()
|
||||
assertTrue (pConf->getString("prop5[@id='2']") == "value6");
|
||||
assertTrue (pConf->getString("prop6[@id=foo].prop7") == "value7");
|
||||
assertTrue (pConf->getString("prop6[@id='bar'].prop7") == "value8");
|
||||
|
||||
|
||||
AbstractConfiguration::Keys keys;
|
||||
pConf->keys(keys);
|
||||
assertTrue (keys.size() == 7);
|
||||
@ -80,7 +80,7 @@ void XMLConfigurationTest::testLoad()
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop5[1]") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop6") != keys.end());
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop6[1]") != keys.end());
|
||||
|
||||
|
||||
pConf->keys("prop3", keys);
|
||||
assertTrue (keys.size() == 2);
|
||||
assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end());
|
||||
@ -93,7 +93,7 @@ void XMLConfigurationTest::testLoad()
|
||||
assertTrue (pConf->hasProperty("prop3"));
|
||||
pConf->remove("prop3");
|
||||
assertTrue (!pConf->hasProperty("prop3"));
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string s = pConf->getString("foo");
|
||||
@ -118,18 +118,18 @@ void XMLConfigurationTest::testSave()
|
||||
{
|
||||
AutoPtr<XMLConfiguration> pConf = new XMLConfiguration;
|
||||
pConf->loadEmpty("config");
|
||||
|
||||
|
||||
std::ostringstream ostr;
|
||||
pConf->save(ostr);
|
||||
std::string s(ostr.str());
|
||||
assertTrue (s == "<config/>\n");
|
||||
|
||||
|
||||
pConf->setString("prop1", "value1");
|
||||
assertTrue (pConf->getString("prop1") == "value1");
|
||||
|
||||
pConf->setString("prop2", "value2");
|
||||
assertTrue (pConf->getString("prop2") == "value2");
|
||||
|
||||
|
||||
pConf->setString("prop3.prop4[@attr]", "value3");
|
||||
assertTrue (pConf->getString("prop3.prop4[@attr]") == "value3");
|
||||
|
||||
@ -154,11 +154,11 @@ void XMLConfigurationTest::testSave()
|
||||
catch (Poco::InvalidArgumentException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::ostringstream ostr2;
|
||||
pConf->save(ostr2);
|
||||
s = ostr2.str();
|
||||
|
||||
|
||||
assertTrue (s ==
|
||||
"<config>\n"
|
||||
"\t<prop1>value1</prop1>\n"
|
||||
@ -170,7 +170,7 @@ void XMLConfigurationTest::testSave()
|
||||
"\t<prop5>value5</prop5>\n"
|
||||
"\t<prop5>value6</prop5>\n"
|
||||
"</config>\n");
|
||||
|
||||
|
||||
pConf->setString("prop1", "value11");
|
||||
assertTrue (pConf->getString("prop1") == "value11");
|
||||
|
||||
@ -226,7 +226,7 @@ void XMLConfigurationTest::testLoadAppendSave()
|
||||
|
||||
void XMLConfigurationTest::testOtherDelimiter()
|
||||
{
|
||||
static const std::string xmlFile =
|
||||
static const std::string xmlFile =
|
||||
"<config>"
|
||||
" <prop1>value1</prop1>"
|
||||
" <prop2>value2</prop2>"
|
||||
@ -243,10 +243,10 @@ void XMLConfigurationTest::testOtherDelimiter()
|
||||
" <prop7>value8</prop7>"
|
||||
" </prop6>"
|
||||
"</config>";
|
||||
|
||||
std::istringstream istr(xmlFile);
|
||||
|
||||
std::istringstream istr(xmlFile);
|
||||
AutoPtr<XMLConfiguration> pConf = new XMLConfiguration(istr, '/');
|
||||
|
||||
|
||||
assertTrue (pConf->getString("prop1") == "value1");
|
||||
assertTrue (pConf->getString("prop2") == "value2");
|
||||
assertTrue (pConf->getString("prop3/prop4[@attr]") == "value3");
|
||||
@ -300,6 +300,27 @@ void XMLConfigurationTest::testLoadEmpty()
|
||||
}
|
||||
|
||||
|
||||
void XMLConfigurationTest::testManyKeys()
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << "<config>\n";
|
||||
const size_t count = 200000;
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
ostr << "<element>" << i << "</element>\n";
|
||||
}
|
||||
ostr << "</config>\n";
|
||||
|
||||
std::istringstream istr(ostr.str());
|
||||
AutoPtr<XMLConfiguration> pConf = new XMLConfiguration(istr);
|
||||
|
||||
AbstractConfiguration::Keys all_elements;
|
||||
pConf->keys("", all_elements);
|
||||
|
||||
assertTrue(all_elements.size() == count);
|
||||
}
|
||||
|
||||
|
||||
void XMLConfigurationTest::setUp()
|
||||
{
|
||||
}
|
||||
@ -322,6 +343,7 @@ CppUnit::Test* XMLConfigurationTest::suite()
|
||||
CppUnit_addTest(pSuite, XMLConfigurationTest, testSaveEmpty);
|
||||
CppUnit_addTest(pSuite, XMLConfigurationTest, testFromScratch);
|
||||
CppUnit_addTest(pSuite, XMLConfigurationTest, testLoadEmpty);
|
||||
CppUnit_addTest(pSuite, XMLConfigurationTest, testManyKeys);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
void testSaveEmpty();
|
||||
void testFromScratch();
|
||||
void testLoadEmpty();
|
||||
void testManyKeys();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
Reference in New Issue
Block a user