summaryrefslogtreecommitdiff
path: root/sax/qa
diff options
context:
space:
mode:
authorArtur Dorda <artur.dorda+libo@gmail.com>2012-08-10 15:12:38 +0200
committerArtur Dorda <artur.dorda+libo@gmail.com>2012-08-15 13:42:18 +0200
commitdaae18fd8f4933aea886dba02a3a16ebd0159728 (patch)
treee1cffd2ed6b9ea9536d6ce4021dc721020ba4322 /sax/qa
parentecb81153407d42da26c52529fd8bcb00abd03975 (diff)
'number to string' test covered
Change-Id: Ic6bdc9448509e6f8251709c22576cc10cf9b8eb2
Diffstat (limited to 'sax/qa')
-rw-r--r--sax/qa/cppunit/test_converter.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index c3cab68a32c8..f0df6ad6e389 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -54,6 +54,7 @@ public:
void testBool();
void testPercent();
void testColor();
+ void testNumber();
CPPUNIT_TEST_SUITE(ConverterTest);
CPPUNIT_TEST(testDuration);
@@ -63,6 +64,7 @@ public:
CPPUNIT_TEST(testBool);
CPPUNIT_TEST(testPercent);
CPPUNIT_TEST(testColor);
+ CPPUNIT_TEST(testNumber);
CPPUNIT_TEST_SUITE_END();
private:
@@ -468,6 +470,24 @@ void ConverterTest::testColor()
doTestColorToString("#fffac7", -1337);
doTestColorToString("#000000", 0);
}
+
+void doTestNumberToString(char const*const pis, sal_Int32 nValue)
+{
+ ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis));
+ ::rtl::OUStringBuffer buf;
+ Converter::convertNumber(buf, nValue);
+ OSL_TRACE("%s", ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr());
+ CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
+}
+
+void ConverterTest::testNumber()
+{
+ doTestNumberToString("333", 333);
+ doTestNumberToString("-1", -1);
+ doTestNumberToString("0", 0000);
+ doTestNumberToString("-1", -0001);
+ doTestNumberToString("0", -0);
+}
CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
}