Add a document test for LAMBDA and the callable functions

A stored document gives broad coverage of the LAMBDA and ISOMITTED
functions and the higher-order functions BYCOL, BYROW, MAKEARRAY,
MAP, REDUCE and SCAN, in more combinations than the unit tests
cover.

Every function has its own sheet that compares each formula result
against the expected value stored beside it. The first sheet
combines all of those per-function checks into a single cell that
is true only when every formula matched.

A filter test loads the document, recalculates it and confirms that
combined cell is true, so a regression in any of the covered
functions makes the test fail.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I9c56e5bae343d53139ad5ac3f68b050678778640
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5587
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 2b7e77fb22b0430f528ebb4d8efeef14c52909e3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207822
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Tomaž Vajngerl
2026-07-09 08:45:43 +02:00
committed by Xisco Fauli
parent 9c34dddef2
commit 9da48950f8
2 changed files with 16 additions and 0 deletions
Binary file not shown.
+16
View File
@@ -1768,6 +1768,22 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testExpandedArrayCollapsesOnNewBlockerXLSX)
CPPUNIT_ASSERT_EQUAL(SCROW(1), nRows);
}
CPPUNIT_TEST_FIXTURE(ScFiltersTest, testLambdaAndRelatedFunctions)
{
// The document checks every LAMBDA and callable-function formula against
// its expected result. Cell B3 of the first sheet holds the combined
// outcome over all the per-function checks, and is true only when every
// check passed. Recalculate with the engine and confirm B3 is true.
createScDoc("xlsx/LambdaAndRelatedFunctions.xlsx");
ScDocument* pDoc = getScDoc();
pDoc->CalcAll();
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"B3 reports that a formula in the document did not match its expected result", 1.0,
pDoc->GetValue(ScAddress(1, 2, 0)), 0.0);
}
ScFiltersTest::ScFiltersTest()
: ScModelTestBase(u"sc/qa/unit/data"_ustr)
{