LCOV - code coverage report
Current view: top level - basic/qa/cppunit - test_scanner.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 671 671 100.0 %
Date: 2015-06-13 12:38:46 Functions: 27 28 96.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <sal/types.h>
      11             : #include <cppunit/TestAssert.h>
      12             : #include <cppunit/TestFixture.h>
      13             : #include <cppunit/extensions/HelperMacros.h>
      14             : #include <cppunit/plugin/TestPlugIn.h>
      15             : 
      16             : #include <osl/file.hxx>
      17             : #include <osl/process.h>
      18             : #include <rtl/math.hxx>
      19             : 
      20             : #include "scanner.hxx"
      21             : 
      22             : namespace
      23             : {
      24        1080 :   struct Symbol
      25             :   {
      26             :     sal_uInt16 line;
      27             :     sal_uInt16 col1;
      28             :     sal_uInt16 col2;
      29             :     OUString text;
      30             :     double number;
      31             :     SbxDataType type;
      32             :   };
      33             : 
      34             :   /**
      35             :    * Perform tests on Scanner.
      36             :    */
      37          30 :   class ScannerTest : public CppUnit::TestFixture
      38             :   {
      39             :   private:
      40             :     void testBlankLines();
      41             :     void testOperators();
      42             :     void testAlphanum();
      43             :     void testComments();
      44             :     void testGoto();
      45             :     void testGotoCompatible();
      46             :     void testExclamation();
      47             :     void testNumbers();
      48             :     void testDataType();
      49             :     void testHexOctal();
      50             : 
      51             :     // Adds code needed to register the test suite
      52           2 :     CPPUNIT_TEST_SUITE(ScannerTest);
      53             : 
      54             :     // Declares the method as a test to call
      55           1 :     CPPUNIT_TEST(testBlankLines);
      56           1 :     CPPUNIT_TEST(testOperators);
      57           1 :     CPPUNIT_TEST(testAlphanum);
      58           1 :     CPPUNIT_TEST(testComments);
      59           1 :     CPPUNIT_TEST(testGoto);
      60           1 :     CPPUNIT_TEST(testGotoCompatible);
      61           1 :     CPPUNIT_TEST(testExclamation);
      62           1 :     CPPUNIT_TEST(testNumbers);
      63           1 :     CPPUNIT_TEST(testDataType);
      64           1 :     CPPUNIT_TEST(testHexOctal);
      65             : 
      66             :     // End of test suite definition
      67           5 :     CPPUNIT_TEST_SUITE_END();
      68             :   };
      69             : 
      70             :   static const char cr[] = "\n";
      71             :   static const char rem[] = "REM";
      72             :   static const char asdf[] = "asdf";
      73             :   static const char dot[] = ".";
      74             :   static const char goto_[] = "goto";
      75             :   static const char excl[] = "!";
      76             : 
      77          81 :   std::vector<Symbol> getSymbols(const OUString& source, sal_Int32& errors, bool bCompatible = false)
      78             :   {
      79          81 :     std::vector<Symbol> symbols;
      80         162 :     SbiScanner scanner(source);
      81          81 :     scanner.EnableErrors();
      82          81 :     scanner.SetCompatible(bCompatible);
      83         361 :     while(scanner.NextSym())
      84             :     {
      85         199 :       Symbol symbol;
      86         199 :       symbol.line = scanner.GetLine();
      87         199 :       symbol.col1 = scanner.GetCol1();
      88         199 :       symbol.col2 = scanner.GetCol2();
      89         199 :       symbol.text = scanner.GetSym();
      90         199 :       symbol.number = scanner.GetDbl();
      91         199 :       symbol.type = scanner.GetType();
      92         199 :       symbols.push_back(symbol);
      93         199 :     }
      94          81 :     errors = scanner.GetErrors();
      95         162 :     return symbols;
      96             :   }
      97             : 
      98          64 :   std::vector<Symbol> getSymbols(const OUString& source, bool bCompatible = false)
      99             :   {
     100             :     sal_Int32 i;
     101          64 :     return getSymbols(source, i, bCompatible);
     102             :   }
     103             : 
     104           1 :   void ScannerTest::testBlankLines()
     105             :   {
     106           1 :     const OUString source1("");
     107           2 :     const OUString source2("\r\n");
     108           2 :     const OUString source3("\n");
     109           2 :     const OUString source4("\r");
     110           2 :     const OUString source5("\r\n\r\n");
     111           2 :     const OUString source6("\n\r");
     112           2 :     const OUString source7("\n\r\n");
     113           2 :     const OUString source8("\r\n\r");
     114           2 :     const OUString source9("      ");
     115             : 
     116           2 :     std::vector<Symbol> symbols;
     117           1 :     symbols = getSymbols(source1);
     118           1 :     CPPUNIT_ASSERT(symbols.empty());
     119             : 
     120           1 :     symbols = getSymbols(source2);
     121           1 :     CPPUNIT_ASSERT(symbols.size() == 1);
     122           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     123           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     124             : 
     125           1 :     symbols = getSymbols(source3);
     126           1 :     CPPUNIT_ASSERT(symbols.size() == 1);
     127           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     128           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     129             : 
     130           1 :     symbols = getSymbols(source4);
     131           1 :     CPPUNIT_ASSERT(symbols.size() == 1);
     132           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     133           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     134             : 
     135           1 :     symbols = getSymbols(source5);
     136           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     137           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     138           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     139           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     140           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     141             : 
     142           1 :     symbols = getSymbols(source6);
     143           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     144           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     145           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     146           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     147           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     148             : 
     149           1 :     symbols = getSymbols(source7);
     150           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     151           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     152           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     153           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     154           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     155             : 
     156           1 :     symbols = getSymbols(source8);
     157           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     158           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     159           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     160           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     161           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     162             : 
     163           1 :     symbols = getSymbols(source9);
     164           1 :     CPPUNIT_ASSERT(symbols.size() == 1);
     165           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     166           2 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     167           1 :   }
     168             : 
     169           1 :   void ScannerTest::testOperators()
     170             :   {
     171           1 :     const OUString sourceE("=");
     172           2 :     const OUString sourceLT("<");
     173           2 :     const OUString sourceGT(">");
     174           2 :     const OUString sourceLTE("<=");
     175           2 :     const OUString sourceGTE(">=");
     176           2 :     const OUString sourceEE("==");
     177           2 :     const OUString sourceNE("<>");
     178           2 :     const OUString sourceA(":=");
     179             : 
     180           2 :     std::vector<Symbol> symbols;
     181             : 
     182           1 :     symbols = getSymbols(sourceE);
     183           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     184           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceE);
     185           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     186           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     187           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     188             : 
     189           1 :     symbols = getSymbols(sourceLT);
     190           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     191           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceLT);
     192           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     193           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     194           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     195             : 
     196           1 :     symbols = getSymbols(sourceGT);
     197           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     198           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceGT);
     199           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     200           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     201           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     202             : 
     203           1 :     symbols = getSymbols(sourceLTE);
     204           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     205           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceLTE);
     206           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     207           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     208           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     209             : 
     210           1 :     symbols = getSymbols(sourceGTE);
     211           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     212           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceGTE);
     213           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     214           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     215           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     216             : 
     217           1 :     symbols = getSymbols(sourceEE);
     218           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     219           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceE);
     220           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     221           1 :     CPPUNIT_ASSERT(symbols[1].text == sourceE);
     222           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     223           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     224           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     225             : 
     226           1 :     symbols = getSymbols(sourceNE);
     227           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     228           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceNE);
     229           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     230           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     231           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     232             : 
     233           1 :     symbols = getSymbols(sourceA);
     234           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     235           1 :     CPPUNIT_ASSERT(symbols[0].text == sourceA);
     236           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     237           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     238           2 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     239           1 :   }
     240             : 
     241           1 :   void ScannerTest::testAlphanum()
     242             :   {
     243           1 :     const OUString source1("asdfghefg");
     244           2 :     const OUString source2("1asfdasfd");
     245           2 :     const OUString source3("AdfsaAUdsl10987");
     246           2 :     const OUString source4("asdfa_mnvcnm");
     247           2 :     const OUString source5("_asdf1");
     248           2 :     const OUString source6("_6");
     249           2 :     const OUString source7("joxclk_");
     250           2 :     const OUString source8("   asdf    ");
     251           2 :     const OUString source9(" 19395  asdfa ");
     252           2 :     const OUString source10("\n1\n2\na sdf");
     253           2 :     const OUString source11("asdf.asdf");
     254           2 :     const OUString source12("..");
     255             : 
     256           2 :     std::vector<Symbol> symbols;
     257             : 
     258           1 :     symbols = getSymbols(source1);
     259           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     260           1 :     CPPUNIT_ASSERT(symbols[0].text == source1);
     261           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     262           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     263           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     264             : 
     265           1 :     symbols = getSymbols(source2);
     266           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     267           1 :     CPPUNIT_ASSERT(symbols[0].text.isEmpty()); // Can't start symbol with a digit
     268           1 :     CPPUNIT_ASSERT(symbols[0].number == 1);
     269           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     270           1 :     CPPUNIT_ASSERT(symbols[1].text == "asfdasfd");
     271           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     272           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     273           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     274             : 
     275           1 :     symbols = getSymbols(source3);
     276           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     277           1 :     CPPUNIT_ASSERT(symbols[0].text == source3);
     278           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     279           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     280           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     281             : 
     282           1 :     symbols = getSymbols(source4);
     283           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     284           1 :     CPPUNIT_ASSERT(symbols[0].text == source4);
     285           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     286           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     287           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     288             : 
     289           1 :     symbols = getSymbols(source5);
     290           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     291           1 :     CPPUNIT_ASSERT(symbols[0].text == source5);
     292           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     293           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     294           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     295             : 
     296           1 :     symbols = getSymbols(source6);
     297           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     298           1 :     CPPUNIT_ASSERT(symbols[0].text == source6);
     299           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     300           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     301           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     302             : 
     303           1 :     symbols = getSymbols(source7);
     304           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     305           1 :     CPPUNIT_ASSERT(symbols[0].text == "joxclk_");
     306           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     307           1 :     CPPUNIT_ASSERT(source7 == "joxclk "); // Change the trailing '_' to a ' '
     308           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     309           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     310             : 
     311           1 :     symbols = getSymbols(source8);
     312           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     313           1 :     CPPUNIT_ASSERT(symbols[0].text == "asdf");
     314           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     315           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     316           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     317             : 
     318           1 :     symbols = getSymbols(source9);
     319           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     320           1 :     CPPUNIT_ASSERT(symbols[0].text.isEmpty());
     321           1 :     CPPUNIT_ASSERT(symbols[0].number == 19395);
     322           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     323           1 :     CPPUNIT_ASSERT(symbols[1].text == "asdfa");
     324           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     325           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     326           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     327             : 
     328           1 :     symbols = getSymbols(source10);
     329           1 :     CPPUNIT_ASSERT(symbols.size() == 8);
     330           1 :     CPPUNIT_ASSERT(symbols[0].text == cr);
     331           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     332           1 :     CPPUNIT_ASSERT(symbols[1].text.isEmpty());
     333           1 :     CPPUNIT_ASSERT(symbols[1].number == 1);
     334           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
     335           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     336           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     337           1 :     CPPUNIT_ASSERT(symbols[3].text.isEmpty());
     338           1 :     CPPUNIT_ASSERT(symbols[3].number == 2);
     339           1 :     CPPUNIT_ASSERT(symbols[3].type == SbxINTEGER);
     340           1 :     CPPUNIT_ASSERT(symbols[4].text == cr);
     341           1 :     CPPUNIT_ASSERT(symbols[4].type == SbxVARIANT);
     342           1 :     CPPUNIT_ASSERT(symbols[5].text.getLength() == 1);
     343           1 :     CPPUNIT_ASSERT(symbols[5].text[0] == 'a');
     344           1 :     CPPUNIT_ASSERT(symbols[5].type == SbxVARIANT);
     345           1 :     CPPUNIT_ASSERT(symbols[6].text == "sdf");
     346           1 :     CPPUNIT_ASSERT(symbols[6].type == SbxVARIANT);
     347           1 :     CPPUNIT_ASSERT(symbols[7].text == cr);
     348           1 :     CPPUNIT_ASSERT(symbols[7].type == SbxVARIANT);
     349             : 
     350           1 :     symbols = getSymbols(source11);
     351           1 :     CPPUNIT_ASSERT(symbols.size() == 4);
     352           1 :     CPPUNIT_ASSERT(symbols[0].text == asdf);
     353           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     354           1 :     CPPUNIT_ASSERT(symbols[1].text == dot);
     355           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     356           1 :     CPPUNIT_ASSERT(symbols[2].text == asdf);
     357           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     358           1 :     CPPUNIT_ASSERT(symbols[3].text == cr);
     359           1 :     CPPUNIT_ASSERT(symbols[3].type == SbxVARIANT);
     360             : 
     361           1 :     symbols = getSymbols(source12);
     362           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     363           1 :     CPPUNIT_ASSERT(symbols[0].text == dot);
     364           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     365           1 :     CPPUNIT_ASSERT(symbols[1].text == dot);
     366           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     367           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     368           2 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     369           1 :   }
     370             : 
     371           1 :   void ScannerTest::testComments()
     372             :   {
     373           1 :     const OUString source1("REM asdf");
     374           2 :     const OUString source2("REMasdf");
     375           2 :     const OUString source3("'asdf");
     376           2 :     const OUString source4("asdf _\n'100");
     377           2 :     const OUString source5("'asdf _\n100");
     378           2 :     const OUString source6("'asdf _\n'100");
     379           2 :     const OUString source7("'asdf _\n 1234 _\n asdf'");
     380             : 
     381           2 :     std::vector<Symbol> symbols;
     382             : 
     383           1 :     symbols = getSymbols(source1);
     384           1 :     CPPUNIT_ASSERT(symbols.size() == 1);
     385           1 :     CPPUNIT_ASSERT(symbols[0].text == rem);
     386           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     387             : 
     388           1 :     symbols = getSymbols(source2);
     389           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     390           1 :     CPPUNIT_ASSERT(symbols[0].text == "REMasdf");
     391           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     392           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     393           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     394             : 
     395           1 :     symbols = getSymbols(source3);
     396           1 :     CPPUNIT_ASSERT(symbols.size() == 1);
     397           1 :     CPPUNIT_ASSERT(symbols[0].text == rem);
     398           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     399             : 
     400           1 :     symbols = getSymbols(source4);
     401           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     402           1 :     CPPUNIT_ASSERT(symbols[0].text == asdf);
     403           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     404           1 :     CPPUNIT_ASSERT(symbols[1].text == rem);
     405           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     406             : 
     407           1 :     symbols = getSymbols(source5);
     408           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     409           1 :     CPPUNIT_ASSERT(symbols[0].text == rem);
     410           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     411           1 :     CPPUNIT_ASSERT(symbols[1].text.isEmpty());
     412           1 :     CPPUNIT_ASSERT(symbols[1].number == 100);
     413           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
     414           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     415           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     416             : 
     417           1 :     symbols = getSymbols(source6);
     418           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     419           1 :     CPPUNIT_ASSERT(symbols[0].text == rem);
     420           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     421           1 :     CPPUNIT_ASSERT(symbols[1].text == rem);
     422           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     423             : 
     424           1 :     symbols = getSymbols(source7);
     425           1 :     CPPUNIT_ASSERT(symbols.size() == 4);
     426           1 :     CPPUNIT_ASSERT(symbols[0].text == rem);
     427           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     428           1 :     CPPUNIT_ASSERT(symbols[1].text.isEmpty());
     429           1 :     CPPUNIT_ASSERT(symbols[1].number == 1234);
     430           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
     431           1 :     CPPUNIT_ASSERT(symbols[2].text == asdf);
     432           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     433           1 :     CPPUNIT_ASSERT(symbols[3].text == rem);
     434           2 :     CPPUNIT_ASSERT(symbols[3].type == SbxVARIANT);
     435           1 :   }
     436             : 
     437           1 :   void ScannerTest::testGoto()
     438             :   {
     439           1 :     const OUString source1("goto");
     440           2 :     const OUString source2("go  to");
     441           2 :     const OUString source3("go\nto");
     442             : 
     443           2 :     std::vector<Symbol> symbols;
     444             : 
     445           1 :     symbols = getSymbols(source1);
     446           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     447           1 :     CPPUNIT_ASSERT(symbols[0].text == goto_);
     448           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     449           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     450           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     451             : 
     452           1 :     symbols = getSymbols(source2);
     453           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     454           1 :     CPPUNIT_ASSERT(symbols[0].text == "go");
     455           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     456           1 :     CPPUNIT_ASSERT(symbols[1].text == "to");
     457           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     458           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     459           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     460             : 
     461           1 :     symbols = getSymbols(source3);
     462           1 :     CPPUNIT_ASSERT(symbols.size() == 4);
     463           1 :     CPPUNIT_ASSERT(symbols[0].text == "go");
     464           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     465           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     466           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     467           1 :     CPPUNIT_ASSERT(symbols[2].text == "to");
     468           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
     469           1 :     CPPUNIT_ASSERT(symbols[3].text == cr);
     470           2 :     CPPUNIT_ASSERT(symbols[3].type == SbxVARIANT);
     471           1 :   }
     472             : 
     473           1 :   void ScannerTest::testGotoCompatible()
     474             :   {
     475           1 :     const OUString source1("goto");
     476           2 :     const OUString source2("go  to");
     477           2 :     const OUString source3("go\nto");
     478             : 
     479           2 :     std::vector<Symbol> symbols;
     480             : 
     481           1 :     symbols = getSymbols(source1, true);
     482           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     483           1 :     CPPUNIT_ASSERT(symbols[0].text == goto_);
     484           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     485             : 
     486           1 :     symbols = getSymbols(source2, true);
     487           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     488           1 :     CPPUNIT_ASSERT(symbols[0].text == goto_);
     489           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     490             : 
     491           1 :     symbols = getSymbols(source3, true);
     492           1 :     CPPUNIT_ASSERT(symbols.size() == 4);
     493           1 :     CPPUNIT_ASSERT(symbols[0].text == "go");
     494           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     495           1 :     CPPUNIT_ASSERT(symbols[2].text == "to");
     496           2 :     CPPUNIT_ASSERT(symbols[3].text == cr);
     497           1 :   }
     498             : 
     499           1 :   void ScannerTest::testExclamation()
     500             :   {
     501           1 :     const OUString source1("asdf!asdf");
     502           2 :     const OUString source2("!1234");
     503           2 :     const OUString source3("!_3");
     504           2 :     const OUString source4("!$");
     505           2 :     const OUString source5("!%");
     506           2 :     const OUString source6("!\n");
     507             : 
     508           2 :     std::vector<Symbol> symbols;
     509             : 
     510           1 :     symbols = getSymbols(source1);
     511           1 :     CPPUNIT_ASSERT(symbols.size() == 4);
     512           1 :     CPPUNIT_ASSERT(symbols[0].text == asdf);
     513           1 :     CPPUNIT_ASSERT(symbols[1].text == excl);
     514           1 :     CPPUNIT_ASSERT(symbols[2].text == asdf);
     515           1 :     CPPUNIT_ASSERT(symbols[3].text == cr);
     516             : 
     517           1 :     symbols = getSymbols(source2);
     518           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     519           1 :     CPPUNIT_ASSERT(symbols[0].text == excl);
     520           1 :     CPPUNIT_ASSERT(symbols[1].text.isEmpty());
     521           1 :     CPPUNIT_ASSERT(symbols[1].number == 1234);
     522           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     523             : 
     524           1 :     symbols = getSymbols(source3);
     525           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     526           1 :     CPPUNIT_ASSERT(symbols[0].text == excl);
     527           1 :     CPPUNIT_ASSERT(symbols[1].text == "_3");
     528           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     529             : 
     530           1 :     symbols = getSymbols(source4);
     531           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     532           1 :     CPPUNIT_ASSERT(symbols[0].text == excl);
     533           1 :     CPPUNIT_ASSERT(symbols[1].text == "$");
     534           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     535             : 
     536           1 :     symbols = getSymbols(source5);
     537           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     538           1 :     CPPUNIT_ASSERT(symbols[0].text == excl);
     539           1 :     CPPUNIT_ASSERT(symbols[1].text == "%");
     540           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     541             : 
     542           1 :     symbols = getSymbols(source6);
     543           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     544           1 :     CPPUNIT_ASSERT(symbols[0].text == excl);
     545           2 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     546           1 :   }
     547             : 
     548           1 :   void ScannerTest::testNumbers()
     549             :   {
     550           1 :     const OUString source1("12345");
     551           2 :     const OUString source2("1.2.3");
     552           2 :     const OUString source3("123.4");
     553           2 :     const OUString source4("0.5");
     554           2 :     const OUString source5("5.0");
     555           2 :     const OUString source6("0.0");
     556           2 :     const OUString source7("-3");
     557           2 :     const OUString source8("-0.0");
     558           2 :     const OUString source9("12dE3");
     559           2 :     const OUString source10("12e3");
     560           2 :     const OUString source11("12D+3");
     561           2 :     const OUString source12("12e++3");
     562           2 :     const OUString source13("12e-3");
     563           2 :     const OUString source14("12e-3+");
     564           2 :     const OUString source15("1,2,3");
     565           2 :     const OUString source16("1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
     566           2 :     const OUString source17("10e308");
     567             : 
     568           2 :     std::vector<Symbol> symbols;
     569             :     sal_Int32 errors;
     570             : 
     571           1 :     symbols = getSymbols(source1, errors);
     572           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     573           1 :     CPPUNIT_ASSERT(symbols[0].number == 12345);
     574           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     575           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     576           1 :     CPPUNIT_ASSERT(errors == 0);
     577             : 
     578           1 :     symbols = getSymbols(source2, errors);
     579           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     580           1 :     CPPUNIT_ASSERT(symbols[0].number == 1.2);
     581           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     582           1 :     CPPUNIT_ASSERT(rtl::math::round( symbols[1].number, 12) == rtl::math::round( .3, 12));
     583           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxDOUBLE);
     584           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     585           1 :     CPPUNIT_ASSERT(errors == 1);
     586             : 
     587           1 :     symbols = getSymbols(source3, errors);
     588           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     589           1 :     CPPUNIT_ASSERT(symbols[0].number == 123.4);
     590           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     591           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     592           1 :     CPPUNIT_ASSERT(errors == 0);
     593             : 
     594           1 :     symbols = getSymbols(source4, errors);
     595           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     596           1 :     CPPUNIT_ASSERT(symbols[0].number == .5);
     597           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     598           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     599           1 :     CPPUNIT_ASSERT(errors == 0);
     600             : 
     601           1 :     symbols = getSymbols(source5, errors);
     602           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     603           1 :     CPPUNIT_ASSERT(symbols[0].number == 5);
     604           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     605           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     606           1 :     CPPUNIT_ASSERT(errors == 0);
     607             : 
     608           1 :     symbols = getSymbols(source6, errors);
     609           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     610           1 :     CPPUNIT_ASSERT(symbols[0].number == 0);
     611           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     612           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     613           1 :     CPPUNIT_ASSERT(errors == 0);
     614             : 
     615           1 :     symbols = getSymbols(source7, errors);
     616           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     617           1 :     CPPUNIT_ASSERT(symbols[0].text == "-");
     618           1 :     CPPUNIT_ASSERT(symbols[1].number == 3);
     619           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
     620           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     621           1 :     CPPUNIT_ASSERT(errors == 0);
     622             : 
     623           1 :     symbols = getSymbols(source8, errors);
     624           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     625           1 :     CPPUNIT_ASSERT(symbols[0].text == "-");
     626           1 :     CPPUNIT_ASSERT(symbols[1].number == 0);
     627           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxDOUBLE);
     628           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     629           1 :     CPPUNIT_ASSERT(errors == 0);
     630             : 
     631           1 :     symbols = getSymbols(source9, errors);
     632           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     633           1 :     CPPUNIT_ASSERT(symbols[0].number == 12);
     634           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     635           1 :     CPPUNIT_ASSERT(symbols[1].text == "dE3");
     636           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     637           1 :     CPPUNIT_ASSERT(errors == 1);
     638             : 
     639           1 :     symbols = getSymbols(source10, errors);
     640           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     641           1 :     CPPUNIT_ASSERT(symbols[0].number == 12000);
     642           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     643           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     644           1 :     CPPUNIT_ASSERT(errors == 0);
     645             : 
     646           1 :     symbols = getSymbols(source11, errors);
     647           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     648           1 :     CPPUNIT_ASSERT(symbols[0].number == 12000);
     649           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     650           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     651           1 :     CPPUNIT_ASSERT(errors == 0);
     652             : 
     653           1 :     symbols = getSymbols(source12, errors);
     654           1 :     CPPUNIT_ASSERT(symbols.size() == 6);
     655           1 :     CPPUNIT_ASSERT(symbols[0].number == 12);
     656           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     657           1 :     CPPUNIT_ASSERT(symbols[1].text == "e");
     658           1 :     CPPUNIT_ASSERT(symbols[2].text == "+");
     659           1 :     CPPUNIT_ASSERT(symbols[3].text == "+");
     660           1 :     CPPUNIT_ASSERT(symbols[4].number == 3);
     661           1 :     CPPUNIT_ASSERT(symbols[4].type == SbxINTEGER);
     662           1 :     CPPUNIT_ASSERT(symbols[5].text == cr);
     663           1 :     CPPUNIT_ASSERT(errors == 1);
     664             : 
     665           1 :     symbols = getSymbols(source13, errors);
     666           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     667           1 :     CPPUNIT_ASSERT(symbols[0].number == .012);
     668           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     669           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     670           1 :     CPPUNIT_ASSERT(errors == 0);
     671             : 
     672           1 :     symbols = getSymbols(source14, errors);
     673           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     674           1 :     CPPUNIT_ASSERT(symbols[0].number == .012);
     675           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     676           1 :     CPPUNIT_ASSERT(symbols[1].text == "+");
     677           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     678           1 :     CPPUNIT_ASSERT(errors == 0);
     679             : 
     680           1 :     symbols = getSymbols(source15, errors);
     681           1 :     CPPUNIT_ASSERT(symbols.size() == 6);
     682           1 :     CPPUNIT_ASSERT(symbols[0].number == 1);
     683           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     684           1 :     CPPUNIT_ASSERT(symbols[1].text == ",");
     685           1 :     CPPUNIT_ASSERT(symbols[2].number == 2);
     686           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxINTEGER);
     687           1 :     CPPUNIT_ASSERT(symbols[3].text == ",");
     688           1 :     CPPUNIT_ASSERT(symbols[4].number == 3);
     689           1 :     CPPUNIT_ASSERT(symbols[4].type == SbxINTEGER);
     690           1 :     CPPUNIT_ASSERT(symbols[5].text == cr);
     691           1 :     CPPUNIT_ASSERT(errors == 0);
     692             : 
     693           1 :     symbols = getSymbols(source16, errors);
     694           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     695           1 :     CPPUNIT_ASSERT(symbols[0].number == 1);
     696           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     697           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     698             :     // This error is from a "buffer overflow" which is stupid because
     699             :     // the buffer is artificially constrained by the scanner.
     700           1 :     CPPUNIT_ASSERT(errors == 1); // HACK
     701             : 
     702           1 :     double fInf = 0.0;
     703           1 :     rtl::math::setInf( &fInf, false);
     704           1 :     symbols = getSymbols(source17, errors);
     705           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     706           1 :     CPPUNIT_ASSERT(symbols[0].number == fInf);
     707           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     708           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     709           2 :     CPPUNIT_ASSERT(errors == 1);    // math error, overflow
     710           1 :   }
     711             : 
     712           1 :   void ScannerTest::testDataType()
     713             :   {
     714           1 :     const OUString source1("asdf%");
     715           2 :     const OUString source2("asdf&");
     716           2 :     const OUString source3("asdf!");
     717           2 :     const OUString source4("asdf#");
     718           2 :     const OUString source5("asdf@");
     719           2 :     const OUString source6("asdf$");
     720           2 :     const OUString source7("asdf ");
     721             : 
     722           2 :     std::vector<Symbol> symbols;
     723             : 
     724           1 :     symbols = getSymbols(source1);
     725           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     726           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     727           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     728             : 
     729           1 :     symbols = getSymbols(source2);
     730           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     731           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxLONG);
     732           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     733             : 
     734           1 :     symbols = getSymbols(source3);
     735           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     736           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxSINGLE);
     737           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     738             : 
     739           1 :     symbols = getSymbols(source4);
     740           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     741           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
     742           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     743             : 
     744           1 :     symbols = getSymbols(source5);
     745           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     746           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxCURRENCY);
     747           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     748             : 
     749           1 :     symbols = getSymbols(source6);
     750           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     751           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxSTRING);
     752           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     753             : 
     754           1 :     symbols = getSymbols(source7);
     755           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     756           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     757           2 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     758           1 :   }
     759             : 
     760           1 :   void ScannerTest::testHexOctal()
     761             :   {
     762           1 :     const OUString source1("&HA");
     763           2 :     const OUString source2("&HASDF");
     764           2 :     const OUString source3("&H10");
     765           2 :     const OUString source4("&&H&1H1&H1");
     766           2 :     const OUString source5("&O&O12");
     767           2 :     const OUString source6("&O10");
     768           2 :     const OUString source7("&HO");
     769           2 :     const OUString source8("&O123000000000000000000000");
     770           2 :     const OUString source9("&H1.23");
     771             : 
     772           2 :     std::vector<Symbol> symbols;
     773             : 
     774           1 :     symbols = getSymbols(source1);
     775           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     776           1 :     CPPUNIT_ASSERT(symbols[0].number == 10);
     777           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     778           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     779           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     780             : 
     781           1 :     symbols = getSymbols(source2);
     782           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     783           1 :     CPPUNIT_ASSERT(symbols[0].number == 2783);
     784           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     785           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     786           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     787             : 
     788           1 :     symbols = getSymbols(source3);
     789           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     790           1 :     CPPUNIT_ASSERT(symbols[0].number == 16);
     791           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     792           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     793           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     794             : 
     795           1 :     symbols = getSymbols(source4);
     796           1 :     CPPUNIT_ASSERT(symbols.size() == 6);
     797           1 :     CPPUNIT_ASSERT(symbols[0].number == 0);
     798           1 :     CPPUNIT_ASSERT(symbols[0].text == "&");
     799           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
     800           1 :     CPPUNIT_ASSERT(symbols[1].number == 0);
     801           1 :     CPPUNIT_ASSERT(symbols[1].text == OUString());
     802           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
     803           1 :     CPPUNIT_ASSERT(symbols[2].number == 1);
     804           1 :     CPPUNIT_ASSERT(symbols[2].text == OUString());
     805           1 :     CPPUNIT_ASSERT(symbols[2].type == SbxINTEGER);
     806           1 :     CPPUNIT_ASSERT(symbols[3].number == 1);
     807           1 :     CPPUNIT_ASSERT(symbols[3].text == "H1");
     808           1 :     CPPUNIT_ASSERT(symbols[3].type == SbxLONG);
     809           1 :     CPPUNIT_ASSERT(symbols[4].number == 1);
     810           1 :     CPPUNIT_ASSERT(symbols[4].text == "H1");
     811           1 :     CPPUNIT_ASSERT(symbols[4].type == SbxVARIANT);
     812           1 :     CPPUNIT_ASSERT(symbols[5].text == cr);
     813             : 
     814           1 :     symbols = getSymbols(source5);
     815           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     816           1 :     CPPUNIT_ASSERT(symbols[0].number == 0);
     817           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     818           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     819           1 :     CPPUNIT_ASSERT(symbols[1].number == 0);
     820           1 :     CPPUNIT_ASSERT(symbols[1].text == "O12");
     821           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
     822           1 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     823             : 
     824           1 :     symbols = getSymbols(source6);
     825           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     826           1 :     CPPUNIT_ASSERT(symbols[0].number == 8);
     827           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     828           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     829           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     830             : 
     831           1 :     symbols = getSymbols(source7);
     832           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     833           1 :     CPPUNIT_ASSERT(symbols[0].number == 0);
     834           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     835           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     836             : 
     837           1 :     symbols = getSymbols(source8);
     838           1 :     CPPUNIT_ASSERT(symbols.size() == 2);
     839             :     // TODO: this line fails on 64 bit systems!!!
     840             :     //    CPPUNIT_ASSERT(symbols[0].number == -1744830464);
     841           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     842           1 :     CPPUNIT_ASSERT(symbols[1].text == cr);
     843             : 
     844           1 :     symbols = getSymbols(source9);
     845           1 :     CPPUNIT_ASSERT(symbols.size() == 3);
     846           1 :     CPPUNIT_ASSERT(symbols[0].text == OUString());
     847           1 :     CPPUNIT_ASSERT(symbols[0].number == 1);
     848           1 :     CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
     849           1 :     CPPUNIT_ASSERT(symbols[1].number == .23);
     850           1 :     CPPUNIT_ASSERT(symbols[1].text == OUString());
     851           1 :     CPPUNIT_ASSERT(symbols[1].type == SbxDOUBLE);
     852           2 :     CPPUNIT_ASSERT(symbols[2].text == cr);
     853           1 :   }
     854             : 
     855             :   // Put the test suite in the registry
     856           1 :   CPPUNIT_TEST_SUITE_REGISTRATION(ScannerTest);
     857             : } // namespace
     858           4 : CPPUNIT_PLUGIN_IMPLEMENT();
     859             : 
     860             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11