summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-01-15 15:41:17 +0100
committerEike Rathke <erack@redhat.com>2022-01-15 17:04:56 +0100
commit26b3fc1f31b682fcc7ac0c10af07e64cffbe86e7 (patch)
tree483d2bc27399cee3228b23970d6a91782d4c6e6a
parent29bc12777ceffd00ed0ae103b8f2affa26897b4e (diff)
A unit test for tdf#146367
Change-Id: Ie47f1525f387d019c7c1131a76faf3784ee99d4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128466 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
-rw-r--r--sc/qa/unit/ucalc_formula.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 551834284f76..c0fb17bc1b59 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -4987,6 +4987,13 @@ void TestFormula::testFuncSUM()
CPPUNIT_ASSERT_EQUAL_MESSAGE("A4 should have inherited the same error as A2.",
static_cast<int>(nErr), static_cast<int>(m_pDoc->GetErrCode(ScAddress(0,3,0))));
+ // Test the dreaded 0.1 + 0.2 - 0.3 != 0.0
+ m_pDoc->SetString(ScAddress(1,0,0), "=SUM(0.1;0.2;-0.3)");
+ CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(1,0,0)));
+ // Also for +/- operators
+ m_pDoc->SetString(ScAddress(1,1,0), "=0.1+0.2-0.3");
+ CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(1,1,0)));
+
m_pDoc->DeleteTab(0);
}