Kaydet (Commit) b13550ed authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Unit test for formula token array vectorization state.

Change-Id: I91dce36e56d86899ba506beb29df6188f10966c0
üst 307b9bfd
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include "calcconfig.hxx" #include "calcconfig.hxx"
#include "interpre.hxx" #include "interpre.hxx"
#include "columniterator.hxx" #include "columniterator.hxx"
#include "types.hxx"
#include "formula/IFunctionDescription.hxx" #include "formula/IFunctionDescription.hxx"
...@@ -1203,6 +1204,8 @@ void Test::testFormulaHashAndTag() ...@@ -1203,6 +1204,8 @@ void Test::testFormulaHashAndTag()
ScAddress aPos1(0,0,0), aPos2(1,0,0); ScAddress aPos1(0,0,0), aPos2(1,0,0);
// Test formula hashing.
struct { struct {
const char* pFormula1; const char* pFormula2; bool bEqual; const char* pFormula1; const char* pFormula2; bool bEqual;
} aHashTests[] = { } aHashTests[] = {
...@@ -1245,6 +1248,37 @@ void Test::testFormulaHashAndTag() ...@@ -1245,6 +1248,37 @@ void Test::testFormulaHashAndTag()
aPos2.IncRow(); aPos2.IncRow();
} }
// Go back to row 1.
aPos1.SetRow(0);
aPos2.SetRow(0);
// Test formula vectorization state.
struct {
const char* pFormula; ScFormulaVectorState eState;
} aVectorTests[] = {
{ "=SUM(1;2;3;4;5)", FormulaVectorEnabled },
{ "=NOW()", FormulaVectorDisabled },
{ "=AVERAGE(X1:Y200)", FormulaVectorCheckReference },
{ "=MAX(X1:Y200;10;20)", FormulaVectorCheckReference },
{ "=MIN(10;11;22)", FormulaVectorEnabled },
{ "=H4", FormulaVectorCheckReference },
};
for (size_t i = 0; i < SAL_N_ELEMENTS(aVectorTests); ++i)
{
m_pDoc->SetString(aPos1, OUString::createFromAscii(aVectorTests[i].pFormula));
ScFormulaVectorState eState = m_pDoc->GetFormulaVectorState(aPos1);
if (eState != aVectorTests[i].eState)
{
std::ostringstream os;
os << "Unexpected vectorization state: expr:" << aVectorTests[i].pFormula;
CPPUNIT_ASSERT_MESSAGE(os.str().c_str(), false);
}
aPos1.IncRow();
}
m_pDoc->DeleteTab(0); m_pDoc->DeleteTab(0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment