summaryrefslogtreecommitdiff
path: root/basic/qa/cppunit
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-10-15 12:17:46 +0200
committerEike Rathke <erack@redhat.com>2013-10-15 12:52:15 +0200
commit66a96c82746118c70a447d7768b0428e15d2f5ad (patch)
tree9b03b73ed296e7f1cc8de39e57f84bc41f794011 /basic/qa/cppunit
parentf85c494b53fc7c9472689a6d94de5f3e185c376e (diff)
clean up SbiScanner::NextSym() a little, fdo#70319 follow-up
Number recognition was suboptimal and didn't properly resync scan positions after having detected an error. Change-Id: I278fdaaf17ed40560785deaaad0e3412a249d90a
Diffstat (limited to 'basic/qa/cppunit')
-rw-r--r--basic/qa/cppunit/test_scanner.cxx29
1 files changed, 16 insertions, 13 deletions
diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx
index acf740fb03a1..b19e52eeffa8 100644
--- a/basic/qa/cppunit/test_scanner.cxx
+++ b/basic/qa/cppunit/test_scanner.cxx
@@ -576,10 +576,12 @@ namespace
CPPUNIT_ASSERT(errors == 0);
symbols = getSymbols(source2, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 1.23);
+ CPPUNIT_ASSERT(symbols.size() == 3);
+ CPPUNIT_ASSERT(symbols[0].number == 1.2);
CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT(rtl::math::round( symbols[1].number, 12) == rtl::math::round( .3, 12));
+ CPPUNIT_ASSERT(symbols[1].type == SbxDOUBLE);
+ CPPUNIT_ASSERT(symbols[2].text == cr);
CPPUNIT_ASSERT(errors == 1);
symbols = getSymbols(source3, errors);
@@ -627,10 +629,11 @@ namespace
CPPUNIT_ASSERT(errors == 0);
symbols = getSymbols(source9, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 12000);
+ CPPUNIT_ASSERT(symbols.size() == 3);
+ CPPUNIT_ASSERT(symbols[0].number == 12);
CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT(symbols[1].text == OUString("dE3"));
+ CPPUNIT_ASSERT(symbols[2].text == cr);
CPPUNIT_ASSERT(errors == 1);
symbols = getSymbols(source10, errors);
@@ -647,16 +650,16 @@ namespace
CPPUNIT_ASSERT(symbols[1].text == cr);
CPPUNIT_ASSERT(errors == 0);
- /* FIXME: SbiScanner::NextSym() is total crap, the result of scanning
- * "12e++3" should be something different than this.. */
symbols = getSymbols(source12, errors);
- CPPUNIT_ASSERT(symbols.size() == 4);
+ CPPUNIT_ASSERT(symbols.size() == 6);
CPPUNIT_ASSERT(symbols[0].number == 12);
CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == OUString("+"));
- CPPUNIT_ASSERT(symbols[2].number == 3);
- CPPUNIT_ASSERT(symbols[2].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[3].text == cr);
+ CPPUNIT_ASSERT(symbols[1].text == OUString("e"));
+ CPPUNIT_ASSERT(symbols[2].text == OUString("+"));
+ CPPUNIT_ASSERT(symbols[3].text == OUString("+"));
+ CPPUNIT_ASSERT(symbols[4].number == 3);
+ CPPUNIT_ASSERT(symbols[4].type == SbxINTEGER);
+ CPPUNIT_ASSERT(symbols[5].text == cr);
CPPUNIT_ASSERT(errors == 1);
symbols = getSymbols(source13, errors);