fix for tests that got broken with Int64 introduction

This commit is contained in:
Aleksandar Fabijanic 2012-06-17 21:39:26 +00:00
parent 771d5ed0b0
commit 378077f209
3 changed files with 10 additions and 6 deletions

View File

@ -180,7 +180,9 @@ Int64 AbstractConfiguration::getInt64(const std::string& key, Int64 defaultValue
std::string value; std::string value;
if (getRaw(key, value)) if (getRaw(key, value))
return NumberParser::tryParse64(internalExpand(value), defaultValue); return NumberParser::parse64(internalExpand(value));
else
return defaultValue;
} }
#endif // defined(POCO_HAVE_INT64) #endif // defined(POCO_HAVE_INT64)

View File

@ -36,12 +36,14 @@
#include "Poco/AutoPtr.h" #include "Poco/AutoPtr.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/Delegate.h" #include "Poco/Delegate.h"
#include "Poco/Types.h"
#include <algorithm> #include <algorithm>
using Poco::Util::AbstractConfiguration; using Poco::Util::AbstractConfiguration;
using Poco::Util::MapConfiguration; using Poco::Util::MapConfiguration;
using Poco::AutoPtr; using Poco::AutoPtr;
using Poco::Int64;
AbstractConfigurationTest::AbstractConfigurationTest(const std::string& name): CppUnit::TestCase(name) AbstractConfigurationTest::AbstractConfigurationTest(const std::string& name): CppUnit::TestCase(name)
@ -129,7 +131,7 @@ void AbstractConfigurationTest::testGetInt64()
try try
{ {
int x = pConf->getInt64("prop1"); Int64 x = pConf->getInt64("prop1");
x=x; x=x;
fail("not a number - must throw"); fail("not a number - must throw");
} }
@ -372,7 +374,7 @@ void AbstractConfigurationTest::testRemove()
pConf->keys(keys); pConf->keys(keys);
assert (keys.size() == 13); assert (keys.size() == 13);
pConf->keys("prop4", keys); pConf->keys("prop4", keys);
assert (keys.size() == 13); assert (keys.size() == 15);
pConf->remove("prop4.bool1"); pConf->remove("prop4.bool1");
assert (!pConf->hasProperty("prop4.bool1")); assert (!pConf->hasProperty("prop4.bool1"));
@ -381,7 +383,7 @@ void AbstractConfigurationTest::testRemove()
pConf->keys(keys); pConf->keys(keys);
assert (keys.size() == 13); assert (keys.size() == 13);
pConf->keys("prop4", keys); pConf->keys("prop4", keys);
assert (keys.size() == 12); assert (keys.size() == 14);
pConf->remove("prop4"); pConf->remove("prop4");
assert (!pConf->hasProperty("prop4.bool1")); assert (!pConf->hasProperty("prop4.bool1"));

View File

@ -124,7 +124,7 @@ void IniFileConfigurationTest::testCaseInsensitiveRemove()
pConf->keys(keys); pConf->keys(keys);
assert (keys.size() == 13); assert (keys.size() == 13);
pConf->keys("prop4", keys); pConf->keys("prop4", keys);
assert (keys.size() == 13); assert (keys.size() == 15);
pConf->remove("PROP4.Bool1"); pConf->remove("PROP4.Bool1");
assert (pConf->hasProperty("Prop1")); assert (pConf->hasProperty("Prop1"));
@ -134,7 +134,7 @@ void IniFileConfigurationTest::testCaseInsensitiveRemove()
pConf->keys(keys); pConf->keys(keys);
assert (keys.size() == 13); assert (keys.size() == 13);
pConf->keys("PROP4", keys); pConf->keys("PROP4", keys);
assert (keys.size() == 12); assert (keys.size() == 14);
pConf->remove("Prop4"); pConf->remove("Prop4");
assert (pConf->hasProperty("Prop1")); assert (pConf->hasProperty("Prop1"));