diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-08 03:35:11 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-08 03:35:11 +0200 |
commit | d9e2c82470b214b45976326f6d6f411add115f77 (patch) | |
tree | ce2c5316dc1c53a91bcd01c73023a506f4434f71 /chart2 | |
parent | bb5d638065590cba700ff46f5a0a1ffbe03b6f1a (diff) |
also add test for DoubleToString
Change-Id: I3de9afa7b5d975487fd03ae2a9c5393143abff9c
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/unit/common_functor_test.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chart2/qa/unit/common_functor_test.cxx b/chart2/qa/unit/common_functor_test.cxx index 272de0743f86..ac4007c69866 100644 --- a/chart2/qa/unit/common_functor_test.cxx +++ b/chart2/qa/unit/common_functor_test.cxx @@ -25,9 +25,11 @@ class CommonFunctorsTest : public CppUnit::TestFixture public: CPPUNIT_TEST_SUITE(CommonFunctorsTest); CPPUNIT_TEST(testAnyToString); + CPPUNIT_TEST(testDoubleToString); CPPUNIT_TEST_SUITE_END(); void testAnyToString(); + void testDoubleToString(); private: }; @@ -54,6 +56,27 @@ void CommonFunctorsTest::testAnyToString() CPPUNIT_ASSERT_EQUAL(OUString("123.456"), aOutput[5]); } +void CommonFunctorsTest::testDoubleToString() +{ + std::vector<double> aInput; + aInput.push_back(2.0); + aInput.push_back(10.0); + aInput.push_back(12.0); + aInput.push_back(15.0); + aInput.push_back(25.234); + aInput.push_back(123.456); + + std::vector<OUString> aOutput; + std::transform(aInput.begin(), aInput.end(), + std::back_inserter(aOutput), chart::CommonFunctors::DoubleToOUString()); + + CPPUNIT_ASSERT_EQUAL(OUString("2"), aOutput[0]); + CPPUNIT_ASSERT_EQUAL(OUString("10"), aOutput[1]); + CPPUNIT_ASSERT_EQUAL(OUString("12"), aOutput[2]); + CPPUNIT_ASSERT_EQUAL(OUString("15"), aOutput[3]); + CPPUNIT_ASSERT_EQUAL(OUString("25.234"), aOutput[4]); + CPPUNIT_ASSERT_EQUAL(OUString("123.456"), aOutput[5]); +} CPPUNIT_TEST_SUITE_REGISTRATION(CommonFunctorsTest); |