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
4d881d03
Kaydet (Commit)
4d881d03
authored
Şub 02, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#74077: Write unit test for this.
Change-Id: Ieacad6dc1909ed5647d8a6f4839c9e9d47cb655c
üst
32b8c5c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
ucalc_formula.cxx
sc/qa/unit/ucalc_formula.cxx
+55
-0
No files found.
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
4d881d03
...
...
@@ -101,6 +101,7 @@ public:
void
testFormulaParseReference
();
void
testFetchVectorRefArray
();
void
testFormulaHashAndTag
();
void
testFormulaTokenEquality
();
void
testFormulaRefData
();
void
testFormulaCompiler
();
void
testFormulaRefUpdate
();
...
...
@@ -324,6 +325,7 @@ public:
CPPUNIT_TEST
(
testFormulaParseReference
);
CPPUNIT_TEST
(
testFetchVectorRefArray
);
CPPUNIT_TEST
(
testFormulaHashAndTag
);
CPPUNIT_TEST
(
testFormulaTokenEquality
);
CPPUNIT_TEST
(
testFormulaRefData
);
CPPUNIT_TEST
(
testFormulaCompiler
);
CPPUNIT_TEST
(
testFormulaRefUpdate
);
...
...
sc/qa/unit/ucalc_formula.cxx
Dosyayı görüntüle @
4d881d03
...
...
@@ -564,6 +564,61 @@ void Test::testFormulaHashAndTag()
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
testFormulaTokenEquality
()
{
struct
Test
{
const
char
*
mpFormula1
;
const
char
*
mpFormula2
;
bool
mbEqual
;
};
Test
aTests
[]
=
{
{
"R1C2"
,
"R1C2"
,
true
},
{
"R1C2"
,
"R1C3"
,
false
},
{
"R1C2"
,
"R2C2"
,
false
},
{
"RC2"
,
"RC[1]"
,
false
},
{
"R1C2:R10C2"
,
"R1C2:R10C2"
,
true
},
{
"R1C2:R10C2"
,
"R1C2:R11C2"
,
false
},
{
"1"
,
"2"
,
false
},
{
"RC[1]+1.2"
,
"RC[1]+1.2"
,
true
},
{
"RC[1]*0.2"
,
"RC[1]*0.5"
,
false
},
{
"
\"
Test1
\"
"
,
"
\"
Test2
\"
"
,
false
},
{
"
\"
Test
\"
"
,
"
\"
Test
\"
"
,
true
},
{
"CONCATENATE(
\"
Test1
\"
)"
,
"CONCATENATE(
\"
Test1
\"
)"
,
true
},
{
"CONCATENATE(
\"
Test1
\"
)"
,
"CONCATENATE(
\"
Test2
\"
)"
,
false
},
};
formula
::
FormulaGrammar
::
Grammar
eGram
=
formula
::
FormulaGrammar
::
GRAM_ENGLISH_XL_R1C1
;
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aTests
);
++
i
)
{
ScFormulaCell
aCell1
(
m_pDoc
,
ScAddress
(),
OUString
::
createFromAscii
(
aTests
[
i
].
mpFormula1
),
eGram
);
ScFormulaCell
aCell2
(
m_pDoc
,
ScAddress
(),
OUString
::
createFromAscii
(
aTests
[
i
].
mpFormula2
),
eGram
);
ScFormulaCell
::
CompareState
eComp
=
aCell1
.
CompareByTokenArray
(
aCell2
);
if
(
aTests
[
i
].
mbEqual
)
{
if
(
eComp
==
ScFormulaCell
::
NotEqual
)
{
std
::
ostringstream
os
;
os
<<
"These two formulas should be evaluated equal: '"
<<
aTests
[
i
].
mpFormula1
<<
"' vs '"
<<
aTests
[
i
].
mpFormula2
<<
"'"
<<
endl
;
CPPUNIT_FAIL
(
os
.
str
().
c_str
());
}
}
else
{
if
(
eComp
!=
ScFormulaCell
::
NotEqual
)
{
std
::
ostringstream
os
;
os
<<
"These two formulas should be evaluated non-equal: '"
<<
aTests
[
i
].
mpFormula1
<<
"' vs '"
<<
aTests
[
i
].
mpFormula2
<<
"'"
<<
endl
;
CPPUNIT_FAIL
(
os
.
str
().
c_str
());
}
}
}
}
void
Test
::
testFormulaRefData
()
{
ScAddress
aAddr
(
4
,
5
,
3
),
aPos
(
2
,
2
,
2
);
...
...
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