You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-generate-better-unit-t...

1159 lines
50 KiB

From 8ebb0f30ab9ba54a1a7b32a53b158890f15033aa Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Sun, 29 Nov 2015 15:33:52 +0100
Subject: [PATCH] generate better unit test assert message
Change-Id: Ibba7f18fefb4f2851472a6ae0b41447237a6b97f
Reviewed-on: https://gerrit.libreoffice.org/20270
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit 36b658d38930b8aca7e16f7a6b286ca1b3e7a215)
Get order of expected/actual args to CPPUNIT_ASSERT_EQUAL right
Change-Id: I0fa26417630991c6d07b5412fb579f9c222d09a6
(cherry picked from commit 88ab9d4aa09a8ce09fa4d03faefa32e57c530746)
tdf#96136 replace CPPUNIT_ASSERT with CPPUNIT_ASSERT_EQUAL
Change-Id: Ib45af8a56ac3adc428c530908cf1bbd95e9cc64c
Reviewed-on: https://gerrit.libreoffice.org/21065
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
(cherry picked from commit 0e41527fd52f676ff6240a08b3fe25607c1ca726)
loplugin:cstylecast
Change-Id: I5ecd63d79e8be77879d3789c45079929696abe03
(cherry picked from commit efcbfa6f429416d7285a593dbd724eaaf3f3841e)
Use CPPUNIT_ASSERT_DOUBLES_EQUAL
...except when checking for infinity
Change-Id: If6e3b8965169cc615fa5d76422e1925866714936
(cherry picked from commit 38e965fe0fcabffadb8fabe6756313b4f37daad5)
---
basic/qa/cppunit/test_scanner.cxx | 882 +++++++++++++++++++-------------------
1 file changed, 441 insertions(+), 441 deletions(-)
diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx
index 2927e6e..ba1320b 100644
--- a/basic/qa/cppunit/test_scanner.cxx
+++ b/basic/qa/cppunit/test_scanner.cxx
@@ -67,12 +67,12 @@ namespace
CPPUNIT_TEST_SUITE_END();
};
- static const char cr[] = "\n";
- static const char rem[] = "REM";
- static const char asdf[] = "asdf";
- static const char dot[] = ".";
- static const char goto_[] = "goto";
- static const char excl[] = "!";
+ static const OUString cr = "\n";
+ static const OUString rem = "REM";
+ static const OUString asdf = "asdf";
+ static const OUString dot = ".";
+ static const OUString goto_ = "goto";
+ static const OUString excl = "!";
std::vector<Symbol> getSymbols(const OUString& source, sal_Int32& errors, bool bCompatible = false)
{
@@ -118,52 +118,52 @@ namespace
CPPUNIT_ASSERT(symbols.empty());
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 1);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 1);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
symbols = getSymbols(source4);
- CPPUNIT_ASSERT(symbols.size() == 1);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
symbols = getSymbols(source5);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source6);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source7);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source8);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source9);
- CPPUNIT_ASSERT(symbols.size() == 1);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
}
void ScannerTest::testOperators()
@@ -180,62 +180,62 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(sourceE);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceE);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceE, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(sourceLT);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceLT);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceLT, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(sourceGT);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceGT);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceGT, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(sourceLTE);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceLTE);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceLTE, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(sourceGTE);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceGTE);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceGTE, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(sourceEE);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == sourceE);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == sourceE);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceE, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(sourceE, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
symbols = getSymbols(sourceNE);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceNE);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceNE, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(sourceA);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == sourceA);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(sourceA, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
}
void ScannerTest::testAlphanum()
@@ -256,116 +256,116 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == source1);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(source1, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 3);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
CPPUNIT_ASSERT(symbols[0].text.isEmpty()); // Can't start symbol with a digit
- CPPUNIT_ASSERT(symbols[0].number == 1);
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == "asfdasfd");
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("asfdasfd"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == source3);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(source3, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source4);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == source4);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(source4, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source5);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == source5);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(source5, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source6);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == source6);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(source6, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source7);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == "joxclk_");
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(source7 == "joxclk "); // Change the trailing '_' to a ' '
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ 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 ' '
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source8);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == "asdf");
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf"), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source9);
- CPPUNIT_ASSERT(symbols.size() == 3);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
CPPUNIT_ASSERT(symbols[0].text.isEmpty());
- CPPUNIT_ASSERT(symbols[0].number == 19395);
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == "asdfa");
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(19395.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("asdfa"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
symbols = getSymbols(source10);
- CPPUNIT_ASSERT(symbols.size() == 8);
- CPPUNIT_ASSERT(symbols[0].text == cr);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(8), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
CPPUNIT_ASSERT(symbols[1].text.isEmpty());
- CPPUNIT_ASSERT(symbols[1].number == 1);
- CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
CPPUNIT_ASSERT(symbols[3].text.isEmpty());
- CPPUNIT_ASSERT(symbols[3].number == 2);
- CPPUNIT_ASSERT(symbols[3].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[4].text == cr);
- CPPUNIT_ASSERT(symbols[4].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[5].text.getLength() == 1);
- CPPUNIT_ASSERT(symbols[5].text[0] == 'a');
- CPPUNIT_ASSERT(symbols[5].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[6].text == "sdf");
- CPPUNIT_ASSERT(symbols[6].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[7].text == cr);
- CPPUNIT_ASSERT(symbols[7].type == SbxVARIANT);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, symbols[3].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[3].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[4].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[4].type);
+ CPPUNIT_ASSERT_EQUAL(1u, (unsigned int)symbols[5].text.getLength());
+ CPPUNIT_ASSERT_EQUAL('a', (char)symbols[5].text[0]);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[5].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("sdf"), symbols[6].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[6].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[7].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[7].type);
symbols = getSymbols(source11);
- CPPUNIT_ASSERT(symbols.size() == 4);
- CPPUNIT_ASSERT(symbols[0].text == asdf);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == dot);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == asdf);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[3].text == cr);
- CPPUNIT_ASSERT(symbols[3].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(dot, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(asdf, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[3].type);
symbols = getSymbols(source12);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == dot);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == dot);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(dot, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(dot, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
}
void ScannerTest::testComments()
@@ -381,57 +381,57 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1);
- CPPUNIT_ASSERT(symbols.size() == 1);
- CPPUNIT_ASSERT(symbols[0].text == rem);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == "REMasdf");
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("REMasdf"), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 1);
- CPPUNIT_ASSERT(symbols[0].text == rem);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
symbols = getSymbols(source4);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == asdf);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == rem);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source5);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == rem);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
CPPUNIT_ASSERT(symbols[1].text.isEmpty());
- CPPUNIT_ASSERT(symbols[1].number == 100);
- CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
symbols = getSymbols(source6);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == rem);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == rem);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source7);
- CPPUNIT_ASSERT(symbols.size() == 4);
- CPPUNIT_ASSERT(symbols[0].text == rem);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
CPPUNIT_ASSERT(symbols[1].text.isEmpty());
- CPPUNIT_ASSERT(symbols[1].number == 1234);
- CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[2].text == asdf);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[3].text == rem);
- CPPUNIT_ASSERT(symbols[3].type == SbxVARIANT);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1234.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(asdf, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
+ CPPUNIT_ASSERT_EQUAL(rem, symbols[3].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[3].type);
}
void ScannerTest::testGoto()
@@ -443,31 +443,31 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == goto_);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(goto_, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == "go");
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == "to");
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("go"), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("to"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 4);
- CPPUNIT_ASSERT(symbols[0].text == "go");
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == "to");
- CPPUNIT_ASSERT(symbols[2].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[3].text == cr);
- CPPUNIT_ASSERT(symbols[3].type == SbxVARIANT);
+ CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("go"), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("to"), symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[3].type);
}
void ScannerTest::testGotoCompatible()
@@ -479,21 +479,21 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1, true);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == goto_);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(goto_, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source2, true);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == goto_);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(goto_, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source3, true);
- CPPUNIT_ASSERT(symbols.size() == 4);
- CPPUNIT_ASSERT(symbols[0].text == "go");
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(symbols[2].text == "to");
- CPPUNIT_ASSERT(symbols[3].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("go"), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(OUString("to"), symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text);
}
void ScannerTest::testExclamation()
@@ -508,41 +508,41 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1);
- CPPUNIT_ASSERT(symbols.size() == 4);
- CPPUNIT_ASSERT(symbols[0].text == asdf);
- CPPUNIT_ASSERT(symbols[1].text == excl);
- CPPUNIT_ASSERT(symbols[2].text == asdf);
- CPPUNIT_ASSERT(symbols[3].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(excl, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(asdf, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text);
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == excl);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text);
CPPUNIT_ASSERT(symbols[1].text.isEmpty());
- CPPUNIT_ASSERT(symbols[1].number == 1234);
- CPPUNIT_ASSERT(symbols[2].text == cr);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1234.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == excl);
- CPPUNIT_ASSERT(symbols[1].text == "_3");
- CPPUNIT_ASSERT(symbols[2].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(OUString("_3"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
symbols = getSymbols(source4);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == excl);
- CPPUNIT_ASSERT(symbols[1].text == "$");
- CPPUNIT_ASSERT(symbols[2].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(OUString("$"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
symbols = getSymbols(source5);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == excl);
- CPPUNIT_ASSERT(symbols[1].text == "%");
- CPPUNIT_ASSERT(symbols[2].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(OUString("%"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
symbols = getSymbols(source6);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].text == excl);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
}
void ScannerTest::testNumbers()
@@ -569,144 +569,144 @@ namespace
sal_Int32 errors;
symbols = getSymbols(source1, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 12345);
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(12345.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source2, errors);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].number == 1.2);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- 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);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.2, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(.3, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(1u, (unsigned int)errors);
symbols = getSymbols(source3, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 123.4);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(123.4, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source4, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == .5);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(.5, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source5, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 5);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source6, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 0);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source7, errors);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == "-");
- CPPUNIT_ASSERT(symbols[1].number == 3);
- CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("-"), symbols[0].text);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source8, errors);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == "-");
- CPPUNIT_ASSERT(symbols[1].number == 0);
- CPPUNIT_ASSERT(symbols[1].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("-"), symbols[0].text);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source9, errors);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].number == 12);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == "dE3");
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(errors == 1);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(12.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("dE3"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(1u, (unsigned int)errors);
symbols = getSymbols(source10, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 12000);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(12000.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source11, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 12000);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(12000.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source12, errors);
- CPPUNIT_ASSERT(symbols.size() == 6);
- CPPUNIT_ASSERT(symbols[0].number == 12);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == "e");
- CPPUNIT_ASSERT(symbols[2].text == "+");
- CPPUNIT_ASSERT(symbols[3].text == "+");
- CPPUNIT_ASSERT(symbols[4].number == 3);
- CPPUNIT_ASSERT(symbols[4].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[5].text == cr);
- CPPUNIT_ASSERT(errors == 1);
+ CPPUNIT_ASSERT_EQUAL(size_t(6), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(12.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("e"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(OUString("+"), symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(OUString("+"), symbols[3].text);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, symbols[4].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[4].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[5].text);
+ CPPUNIT_ASSERT_EQUAL(1u, (unsigned int)errors);
symbols = getSymbols(source13, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == .012);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(.012, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source14, errors);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].number == .012);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == "+");
- CPPUNIT_ASSERT(symbols[2].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(.012, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString("+"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source15, errors);
- CPPUNIT_ASSERT(symbols.size() == 6);
- CPPUNIT_ASSERT(symbols[0].number == 1);
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == ",");
- CPPUNIT_ASSERT(symbols[2].number == 2);
- CPPUNIT_ASSERT(symbols[2].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[3].text == ",");
- CPPUNIT_ASSERT(symbols[4].number == 3);
- CPPUNIT_ASSERT(symbols[4].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[5].text == cr);
- CPPUNIT_ASSERT(errors == 0);
+ CPPUNIT_ASSERT_EQUAL(size_t(6), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(OUString(","), symbols[1].text);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, symbols[2].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[2].type);
+ CPPUNIT_ASSERT_EQUAL(OUString(","), symbols[3].text);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, symbols[4].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[4].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[5].text);
+ CPPUNIT_ASSERT_EQUAL(0u, (unsigned int)errors);
symbols = getSymbols(source16, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 1);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
// This error is from a "buffer overflow" which is stupid because
// the buffer is artificially constrained by the scanner.
- CPPUNIT_ASSERT(errors == 1); // HACK
+ CPPUNIT_ASSERT_EQUAL(1u, (unsigned int)errors); // HACK
double fInf = 0.0;
rtl::math::setInf( &fInf, false);
symbols = getSymbols(source17, errors);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == fInf);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
- CPPUNIT_ASSERT(errors == 1); // math error, overflow
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(fInf, symbols[0].number);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(1u, (unsigned int)errors); // math error, overflow
}
void ScannerTest::testDataType()
@@ -722,39 +722,39 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxLONG);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxLONG, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxSINGLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxSINGLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source4);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source5);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxCURRENCY);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxCURRENCY, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source6);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxSTRING);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxSTRING, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source7);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
}
void ScannerTest::testHexOctal()
@@ -772,84 +772,84 @@ namespace
std::vector<Symbol> symbols;
symbols = getSymbols(source1);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 10);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source2);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 2783);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2783.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source3);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 16);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(16.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source4);
- CPPUNIT_ASSERT(symbols.size() == 6);
- CPPUNIT_ASSERT(symbols[0].number == 0);
- CPPUNIT_ASSERT(symbols[0].text == "&");
- CPPUNIT_ASSERT(symbols[0].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[1].number == 0);
- CPPUNIT_ASSERT(symbols[1].text == OUString());
- CPPUNIT_ASSERT(symbols[1].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[2].number == 1);
- CPPUNIT_ASSERT(symbols[2].text == OUString());
- CPPUNIT_ASSERT(symbols[2].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[3].number == 1);
- CPPUNIT_ASSERT(symbols[3].text == "H1");
- CPPUNIT_ASSERT(symbols[3].type == SbxLONG);
- CPPUNIT_ASSERT(symbols[4].number == 1);
- CPPUNIT_ASSERT(symbols[4].text == "H1");
- CPPUNIT_ASSERT(symbols[4].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[5].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(6), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString("&"), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[1].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[2].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[2].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[2].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[3].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString("H1"), symbols[3].text);
+ CPPUNIT_ASSERT_EQUAL(SbxLONG, symbols[3].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[4].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString("H1"), symbols[4].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[4].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[5].text);
symbols = getSymbols(source5);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].number == 0);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].number == 0);
- CPPUNIT_ASSERT(symbols[1].text == "O12");
- CPPUNIT_ASSERT(symbols[1].type == SbxVARIANT);
- CPPUNIT_ASSERT(symbols[2].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString("O12"), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
symbols = getSymbols(source6);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 8);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source7);
- CPPUNIT_ASSERT(symbols.size() == 2);
- CPPUNIT_ASSERT(symbols[0].number == 0);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source8);
- CPPUNIT_ASSERT(symbols.size() == 2);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size());
// TODO: this line fails on 64 bit systems!!!
- // CPPUNIT_ASSERT(symbols[0].number == -1744830464);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[1].text == cr);
+ // CPPUNIT_ASSERT_EQUAL(symbols[0].number, -1744830464);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text);
symbols = getSymbols(source9);
- CPPUNIT_ASSERT(symbols.size() == 3);
- CPPUNIT_ASSERT(symbols[0].text == OUString());
- CPPUNIT_ASSERT(symbols[0].number == 1);
- CPPUNIT_ASSERT(symbols[0].type == SbxINTEGER);
- CPPUNIT_ASSERT(symbols[1].number == .23);
- CPPUNIT_ASSERT(symbols[1].text == OUString());
- CPPUNIT_ASSERT(symbols[1].type == SbxDOUBLE);
- CPPUNIT_ASSERT(symbols[2].text == cr);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size());
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(.23, symbols[1].number, 1E-12);
+ CPPUNIT_ASSERT_EQUAL(OUString(), symbols[1].text);
+ CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[1].type);
+ CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text);
}
// Put the test suite in the registry
--
2.5.0