summaryrefslogtreecommitdiff
path: root/basic/qa
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-11-18 01:20:36 -0500
committerAugust Sodora <augsod@gmail.com>2011-11-18 01:20:36 -0500
commitc8f0503a1b2ab399468125288803d16802064c94 (patch)
tree649aab27a0f8258c29a17ab97ac7db2e8a8b8b9f /basic/qa
parent339777016344fe463e83c71fc3d130309e99e3d7 (diff)
Cleanup GetSuffixType in basic scanner
Diffstat (limited to 'basic/qa')
-rw-r--r--basic/qa/cppunit/test_scanner.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx
index 25f5147f46ff..dd46b7a48e34 100644
--- a/basic/qa/cppunit/test_scanner.cxx
+++ b/basic/qa/cppunit/test_scanner.cxx
@@ -36,6 +36,7 @@ namespace
void testGoto();
void testExclamation();
void testNumbers();
+ void testDataType();
// Adds code needed to register the test suite
CPPUNIT_TEST_SUITE(ScannerTest);
@@ -48,6 +49,7 @@ namespace
CPPUNIT_TEST(testGoto);
CPPUNIT_TEST(testExclamation);
CPPUNIT_TEST(testNumbers);
+ CPPUNIT_TEST(testDataType);
// End of test suite definition
CPPUNIT_TEST_SUITE_END();
@@ -564,6 +566,54 @@ namespace
CPPUNIT_ASSERT(symbols[1].text == cr);
}
+ void ScannerTest::testDataType()
+ {
+ const rtl::OUString source1(RTL_CONSTASCII_USTRINGPARAM("asdf%"));
+ const rtl::OUString source2(RTL_CONSTASCII_USTRINGPARAM("asdf&"));
+ const rtl::OUString source3(RTL_CONSTASCII_USTRINGPARAM("asdf!"));
+ const rtl::OUString source4(RTL_CONSTASCII_USTRINGPARAM("asdf#"));
+ const rtl::OUString source5(RTL_CONSTASCII_USTRINGPARAM("asdf@"));
+ const rtl::OUString source6(RTL_CONSTASCII_USTRINGPARAM("asdf$"));
+ const rtl::OUString source7(RTL_CONSTASCII_USTRINGPARAM("asdf "));
+
+ std::vector<Symbol> symbols;
+
+ symbols = getSymbols(source1);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+
+ symbols = getSymbols(source2);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxLONG);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+
+ symbols = getSymbols(source3);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxSINGLE);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+
+ symbols = getSymbols(source4);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+
+ symbols = getSymbols(source5);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxCURRENCY);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+
+ symbols = getSymbols(source6);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxSTRING);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+
+ symbols = getSymbols(source7);
+ CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT(symbols[1].text == cr);
+ }
+
// Put the test suite in the registry
CPPUNIT_TEST_SUITE_REGISTRATION(ScannerTest);
} // namespace