diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-15 23:43:35 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-24 23:29:22 -0400 |
commit | 5f9d48f96238ce35c98c260b1ac5f1d0a35aede1 (patch) | |
tree | 124012e16cb1c064f769e4bca1a42091e827007e | |
parent | da236c0332126295748e65d0d82aa602d8ecde90 (diff) |
Add some basic test for single reference data.
I'll add more later.
Change-Id: Ia65f29886c36fc268e4e8aa77e09b03628c5dccf
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 3 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 3 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 20 |
3 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 9c1594efd961..7eb4d4553e75 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -162,6 +162,9 @@ public: #define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result ) \ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 1e-14 ) +#define ASSERT_EQUAL_TYPE( type, expected, result ) \ + CPPUNIT_ASSERT_EQUAL( static_cast<type>(expected), static_cast<type>(result) ); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 0f0198cfdcdb..7582e632ad82 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -82,7 +82,9 @@ public: void testCollator(); void testRangeList(); void testInput(); + void testFormulaHashAndTag(); + void testFormulaRefData(); void testFormulaCompiler(); void testFuncSUM(); void testFuncPRODUCT(); @@ -268,6 +270,7 @@ public: CPPUNIT_TEST(testRangeList); CPPUNIT_TEST(testInput); CPPUNIT_TEST(testFormulaHashAndTag); + CPPUNIT_TEST(testFormulaRefData); CPPUNIT_TEST(testFormulaCompiler); CPPUNIT_TEST(testFuncSUM); CPPUNIT_TEST(testFuncPRODUCT); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 7b029de54e6a..352259fd3b2d 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -13,6 +13,7 @@ #include "interpre.hxx" #include "compiler.hxx" #include "tokenarray.hxx" +#include "refdata.hxx" #include <boost/scoped_ptr.hpp> @@ -109,6 +110,25 @@ void Test::testFormulaHashAndTag() m_pDoc->DeleteTab(0); } +void Test::testFormulaRefData() +{ + ScAddress aAddr(4,5,3), aPos(2,2,2); + ScSingleRefData aRefData; + aRefData.InitAddress(aAddr); + CPPUNIT_ASSERT_MESSAGE("Wrong ref data state.", !aRefData.IsRowRel() && !aRefData.IsColRel() && !aRefData.IsTabRel()); + ASSERT_EQUAL_TYPE(SCCOL, 4, aRefData.GetCol()); + ASSERT_EQUAL_TYPE(SCROW, 5, aRefData.GetRow()); + ASSERT_EQUAL_TYPE(SCTAB, 3, aRefData.GetTab()); + + aRefData.SetRowRel(true); + aRefData.SetColRel(true); + aRefData.SetTabRel(true); + aRefData.SetAddress(aAddr, aPos); + ASSERT_EQUAL_TYPE(SCCOL, 2, aRefData.GetCol()); + ASSERT_EQUAL_TYPE(SCROW, 3, aRefData.GetRow()); + ASSERT_EQUAL_TYPE(SCTAB, 1, aRefData.GetTab()); +} + void Test::testFormulaCompiler() { struct { |