mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
trunk/branch integration: unit test integration
This commit is contained in:
@@ -12,14 +12,14 @@
|
||||
// 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
|
||||
@@ -60,13 +60,13 @@ void NumberFormatterTest::testFormat()
|
||||
assert (NumberFormatter::format((unsigned) 123) == "123");
|
||||
assert (NumberFormatter::format((unsigned) 123, 5) == " 123");
|
||||
assert (NumberFormatter::format0((unsigned) 123, 5) == "00123");
|
||||
|
||||
|
||||
assert (NumberFormatter::format((long) 123) == "123");
|
||||
assert (NumberFormatter::format((long) -123) == "-123");
|
||||
assert (NumberFormatter::format((long) -123, 5) == " -123");
|
||||
|
||||
assert (NumberFormatter::format((unsigned long) 123) == "123");
|
||||
assert (NumberFormatter::format((unsigned long) 123, 5) == " 123");
|
||||
assert (NumberFormatter::format((unsigned long) 123, 5) == " 123");
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
assert (NumberFormatter::format((Int64) 123) == "123");
|
||||
@@ -74,7 +74,7 @@ void NumberFormatterTest::testFormat()
|
||||
assert (NumberFormatter::format((Int64) -123, 5) == " -123");
|
||||
|
||||
assert (NumberFormatter::format((UInt64) 123) == "123");
|
||||
assert (NumberFormatter::format((UInt64) 123, 5) == " 123");
|
||||
assert (NumberFormatter::format((UInt64) 123, 5) == " 123");
|
||||
#endif
|
||||
|
||||
if (sizeof(void*) == 4)
|
||||
@@ -85,17 +85,17 @@ void NumberFormatterTest::testFormat()
|
||||
{
|
||||
assert (NumberFormatter::format((void*) 0x12345678) == "0000000012345678");
|
||||
}
|
||||
|
||||
assert (NumberFormatter::format(12.25) == "12.25");
|
||||
assert (NumberFormatter::format(12.25, 4) == "12.2500");
|
||||
assert (NumberFormatter::format(12.25, 8, 4) == " 12.2500");
|
||||
|
||||
assert (NumberFormatter::format(12.25) == "12.25");
|
||||
assert (NumberFormatter::format(12.25, 4) == "12.2500");
|
||||
assert (NumberFormatter::format(12.25, 8, 4) == " 12.2500");
|
||||
|
||||
assert (NumberFormatter::format(true, NumberFormatter::FMT_TRUE_FALSE) == "true");
|
||||
assert (NumberFormatter::format(false, NumberFormatter::FMT_TRUE_FALSE) == "false");
|
||||
assert (NumberFormatter::format(true, NumberFormatter::FMT_YES_NO) == "yes");
|
||||
assert (NumberFormatter::format(false, NumberFormatter::FMT_YES_NO) == "no");
|
||||
assert (NumberFormatter::format(true, NumberFormatter::FMT_ON_OFF) == "on");
|
||||
assert (NumberFormatter::format(false, NumberFormatter::FMT_ON_OFF) == "off");
|
||||
assert (NumberFormatter::format(true, NumberFormatter::FMT_TRUE_FALSE) == "true");
|
||||
assert (NumberFormatter::format(false, NumberFormatter::FMT_TRUE_FALSE) == "false");
|
||||
assert (NumberFormatter::format(true, NumberFormatter::FMT_YES_NO) == "yes");
|
||||
assert (NumberFormatter::format(false, NumberFormatter::FMT_YES_NO) == "no");
|
||||
assert (NumberFormatter::format(true, NumberFormatter::FMT_ON_OFF) == "on");
|
||||
assert (NumberFormatter::format(false, NumberFormatter::FMT_ON_OFF) == "off");
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,20 @@ void NumberFormatterTest::testFormatHex()
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatterTest::testFormatFloat()
|
||||
{
|
||||
std::string s(NumberFormatter::format(1.0f));
|
||||
assert (s == "1");
|
||||
s = NumberFormatter::format(0.1f);
|
||||
assert (s == "0.1");
|
||||
|
||||
s = NumberFormatter::format(1.0);
|
||||
assert (s == "1");
|
||||
s = NumberFormatter::format(0.1);
|
||||
assert (s == "0.1");
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatterTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -165,9 +179,10 @@ CppUnit::Test* NumberFormatterTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("NumberFormatterTest");
|
||||
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormat);
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormat0);
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormatHex);
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormat);
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormat0);
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormatHex);
|
||||
CppUnit_addTest(pSuite, NumberFormatterTest, testFormatFloat);
|
||||
|
||||
return pSuite;
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user