[Libreoffice-commits] core.git: sc/qa
Łukasz Hryniuk
lukasz.hryniuk at wp.pl
Mon Aug 10 15:27:20 PDT 2015
sc/qa/unit/ucalc.hxx | 2 +
sc/qa/unit/ucalc_formula.cxx | 54 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
New commits:
commit 066f3132effa9017fe9127e9d311d6ae88d0c729
Author: Łukasz Hryniuk <lukasz.hryniuk at wp.pl>
Date: Mon Aug 10 17:13:02 2015 +0200
tdf#89387 a few tests for FTEST function
Change-Id: I96747f4ffd070a0d1511cef6f56c9a253949ee97
Reviewed-on: https://gerrit.libreoffice.org/17628
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 7c54dc0..3e03b5f 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -184,6 +184,7 @@ public:
void testFuncRangeOp();
void testFuncFORMULA();
void testFuncTableRef();
+ void testFuncFTEST();
void testExternalRef();
void testExternalRefFunctions();
@@ -514,6 +515,7 @@ public:
CPPUNIT_TEST(testFuncRangeOp);
CPPUNIT_TEST(testFuncFORMULA);
CPPUNIT_TEST(testFuncTableRef);
+ CPPUNIT_TEST(testFuncFTEST);
CPPUNIT_TEST(testExternalRef);
CPPUNIT_TEST(testExternalRefFunctions);
CPPUNIT_TEST(testCopyToDocument);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 720ff5e..0a9fd2d 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -5522,4 +5522,58 @@ void Test::testFuncTableRef()
m_pDoc->DeleteTab(0);
}
+void Test::testFuncFTEST()
+{
+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
+
+ m_pDoc->InsertTab(0, "FTest");
+
+ ScAddress aPos(6,0,0);
+ m_pDoc->SetString(aPos, "=FTEST(A1:C3;D1:F3)");
+ m_pDoc->SetValue(0, 0, 0, 9.0); // A1
+ OUString aVal = m_pDoc->GetString(aPos);
+ CPPUNIT_ASSERT_MESSAGE("FTEST should return #VALUE! for less than 2 values",
+ OUString::createFromAscii("#VALUE!") == aVal);
+ m_pDoc->SetValue(0, 1, 0, 8.0); // A2
+ aVal = m_pDoc->GetString(aPos);
+ CPPUNIT_ASSERT_MESSAGE("FTEST should return #VALUE! for less than 2 values",
+ OUString::createFromAscii("#VALUE!") == aVal);
+ m_pDoc->SetValue(3, 0, 0, 5.0); // D1
+ aVal = m_pDoc->GetString(aPos);
+ CPPUNIT_ASSERT_MESSAGE("FTEST should return #VALUE! for less than 2 values",
+ OUString::createFromAscii("#VALUE!") == aVal);
+ m_pDoc->SetValue(3, 1, 0, 6.0); // D2
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 1.0000, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(1, 0, 0, 6.0); // B1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.6222, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(1, 1, 0, 8.0); // B2
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.7732, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(4, 0, 0, 7.0); // E1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.8194, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(4, 1, 0, 4.0); // E2
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.9674, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(2, 0, 0, 3.0); // C1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.3402, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(5, 0, 0, 28.0); // F1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0161, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(2, 1, 0, 9.0); // C2
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0063, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(5, 1, 0, 4.0); // F2
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0081, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(0, 2, 0, 2.0); // A3
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0122, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(3, 2, 0, 8.0); // D3
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0178, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(1, 2, 0, 4.0); // B3
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0093, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(4, 2, 0, 7.0); // E3
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0132, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(5, 2, 0, 5.0); // F3
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0168, m_pDoc->GetValue(aPos), 10e-4);
+ m_pDoc->SetValue(2, 2, 0, 13.0); // C3
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculation of FTEST failed", 0.0422, m_pDoc->GetValue(aPos), 10e-4);
+
+ m_pDoc->DeleteTab(0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list