Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
7d1c2f22
Kaydet (Commit)
7d1c2f22
authored
Kas 28, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added unit test for horizontal MATCH, fdo#71589
Change-Id: Ib3195870e708db49448d68d262611561c68ddcc6
üst
d78a1913
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
1 deletion
+47
-1
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+47
-1
No files found.
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
7d1c2f22
...
...
@@ -2158,13 +2158,53 @@ void runTestMATCH(ScDocument* pDoc, const char* aData[_DataSize], StrStrCheck aC
}
}
template
<
size_t
_DataSize
,
size_t
_FormulaSize
,
int
_Type
>
void
runTestHorizontalMATCH
(
ScDocument
*
pDoc
,
const
char
*
aData
[
_DataSize
],
StrStrCheck
aChecks
[
_FormulaSize
])
{
size_t
nDataSize
=
_DataSize
;
for
(
size_t
i
=
0
;
i
<
nDataSize
;
++
i
)
pDoc
->
SetString
(
i
,
0
,
0
,
OUString
::
createFromAscii
(
aData
[
i
]));
for
(
size_t
i
=
0
;
i
<
_FormulaSize
;
++
i
)
{
pDoc
->
SetString
(
i
,
1
,
0
,
OUString
::
createFromAscii
(
aChecks
[
i
].
pVal
));
// Assume we don't have more than 26 data columns..
OUStringBuffer
aBuf
;
aBuf
.
appendAscii
(
"=MATCH("
);
aBuf
.
append
(
static_cast
<
sal_Unicode
>
(
'A'
+
i
));
aBuf
.
appendAscii
(
"2;A1:"
);
aBuf
.
append
(
static_cast
<
sal_Unicode
>
(
'A'
+
nDataSize
));
aBuf
.
appendAscii
(
"1;"
);
aBuf
.
append
(
static_cast
<
sal_Int32
>
(
_Type
));
aBuf
.
appendAscii
(
")"
);
OUString
aFormula
=
aBuf
.
makeStringAndClear
();
pDoc
->
SetString
(
i
,
2
,
0
,
aFormula
);
}
pDoc
->
CalcAll
();
Test
::
printRange
(
pDoc
,
ScRange
(
0
,
0
,
0
,
_FormulaSize
-
1
,
2
,
0
),
"MATCH"
);
// verify the results.
for
(
size_t
i
=
0
;
i
<
_FormulaSize
;
++
i
)
{
OUString
aStr
=
pDoc
->
GetString
(
i
,
2
,
0
);
if
(
!
aStr
.
equalsAscii
(
aChecks
[
i
].
pRes
))
{
cerr
<<
"column "
<<
char
(
'A'
+
i
)
<<
": expected='"
<<
aChecks
[
i
].
pRes
<<
"' actual='"
<<
aStr
<<
"'"
<<
" criterion='"
<<
aChecks
[
i
].
pVal
<<
"'"
<<
endl
;
CPPUNIT_ASSERT_MESSAGE
(
"Unexpected result for horizontal MATCH"
,
false
);
}
}
}
void
Test
::
testFuncMATCH
()
{
OUString
aTabName
(
"foo"
);
CPPUNIT_ASSERT_MESSAGE
(
"failed to insert sheet"
,
m_pDoc
->
InsertTab
(
0
,
aTabName
));
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
4
,
40
,
0
));
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
4
0
,
40
,
0
));
{
// Ascending in-exact match
...
...
@@ -2204,6 +2244,9 @@ void Test::testFuncMATCH()
};
runTestMATCH
<
SAL_N_ELEMENTS
(
aData
),
SAL_N_ELEMENTS
(
aChecks
),
1
>
(
m_pDoc
,
aData
,
aChecks
);
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
4
,
40
,
0
));
runTestHorizontalMATCH
<
SAL_N_ELEMENTS
(
aData
),
SAL_N_ELEMENTS
(
aChecks
),
1
>
(
m_pDoc
,
aData
,
aChecks
);
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
40
,
4
,
0
));
}
{
...
...
@@ -2246,6 +2289,9 @@ void Test::testFuncMATCH()
};
runTestMATCH
<
SAL_N_ELEMENTS
(
aData
),
SAL_N_ELEMENTS
(
aChecks
),
-
1
>
(
m_pDoc
,
aData
,
aChecks
);
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
4
,
40
,
0
));
runTestHorizontalMATCH
<
SAL_N_ELEMENTS
(
aData
),
SAL_N_ELEMENTS
(
aChecks
),
-
1
>
(
m_pDoc
,
aData
,
aChecks
);
clearRange
(
m_pDoc
,
ScRange
(
0
,
0
,
0
,
40
,
4
,
0
));
}
m_pDoc
->
DeleteTab
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment