diff options
Diffstat (limited to 'basic/qa/cppunit/test_scanner.cxx')
-rw-r--r-- | basic/qa/cppunit/test_scanner.cxx | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx index 5663c44d027e..f17750c89a6e 100644 --- a/basic/qa/cppunit/test_scanner.cxx +++ b/basic/qa/cppunit/test_scanner.cxx @@ -13,7 +13,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/plugin/TestPlugIn.h> -#include <rtl/math.hxx> +#include <limits> #include <scanner.hxx> @@ -69,12 +69,12 @@ private: CPPUNIT_TEST_SUITE_END(); }; -const OUString cr = "\n"; -const OUString rem = "REM"; -const OUString asdf = "asdf"; -const OUString dot = "."; -const OUString goto_ = "goto"; -const OUString excl = "!"; +constexpr OUString cr = u"\n"_ustr; +constexpr OUString rem = u"REM"_ustr; +constexpr OUString asdf = u"asdf"_ustr; +constexpr OUString dot = u"."_ustr; +constexpr OUString goto_ = u"goto"_ustr; +constexpr OUString excl = u"!"_ustr; std::vector<Symbol> getSymbols(const OUString& source, sal_Int32& errors, bool bCompatible = false) { @@ -160,14 +160,14 @@ void ScannerTest::testBlankLines() void ScannerTest::testOperators() { - const OUString sourceE("="); - const OUString sourceLT("<"); - const OUString sourceGT(">"); - const OUString sourceLTE("<="); - const OUString sourceGTE(">="); - const OUString sourceNE("<>"); - const OUString sourceA(":="); - const OUString sourceNot("Not"); + constexpr OUString sourceE(u"="_ustr); + constexpr OUString sourceLT(u"<"_ustr); + constexpr OUString sourceGT(u">"_ustr); + constexpr OUString sourceLTE(u"<="_ustr); + constexpr OUString sourceGTE(u">="_ustr); + constexpr OUString sourceNE(u"<>"_ustr); + constexpr OUString sourceA(u":="_ustr); + constexpr OUString sourceNot(u"Not"_ustr); std::vector<Symbol> symbols; @@ -239,12 +239,12 @@ void ScannerTest::testOperators() void ScannerTest::testAlphanum() { - const OUString source1("asdfghefg"); - const OUString source3("AdfsaAUdsl10987"); - const OUString source4("asdfa_mnvcnm"); - const OUString source5("_asdf1"); - const OUString source6("_6"); - const OUString source7("joxclk_"); + constexpr OUString source1(u"asdfghefg"_ustr); + constexpr OUString source3(u"AdfsaAUdsl10987"_ustr); + constexpr OUString source4(u"asdfa_mnvcnm"_ustr); + constexpr OUString source5(u"_asdf1"_ustr); + constexpr OUString source6(u"_6"_ustr); + constexpr OUString source7(u"joxclk_"_ustr); std::vector<Symbol> symbols; @@ -297,7 +297,8 @@ void ScannerTest::testAlphanum() CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(OUString("joxclk_"), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("joxclk "), source7); // Change the trailing '_' to a ' ' + // tdf#125637 - don't change underscore to space + CPPUNIT_ASSERT_EQUAL(OUString("joxclk_"), source7); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); @@ -654,11 +655,9 @@ void ScannerTest::testNumbers() // the buffer is artificially constrained by the scanner. CPPUNIT_ASSERT_EQUAL(1u, static_cast<unsigned int>(errors)); // HACK - double fInf = 0.0; - rtl::math::setInf(&fInf, false); symbols = getSymbols("10e308", errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); - CPPUNIT_ASSERT_EQUAL(fInf, symbols[0].number); + CPPUNIT_ASSERT_EQUAL(std::numeric_limits<double>::infinity(), symbols[0].number); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(1u, static_cast<unsigned int>(errors)); // math error, overflow |