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
b97774ae
Kaydet (Commit)
b97774ae
authored
Kas 20, 2011
tarafından
August Sodora
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added regression test for scanner
üst
63d29ac4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
test_scanner.cxx
basic/qa/cppunit/test_scanner.cxx
+30
-1
No files found.
basic/qa/cppunit/test_scanner.cxx
Dosyayı görüntüle @
b97774ae
...
@@ -34,6 +34,7 @@ namespace
...
@@ -34,6 +34,7 @@ namespace
void
testAlphanum
();
void
testAlphanum
();
void
testComments
();
void
testComments
();
void
testGoto
();
void
testGoto
();
void
testGotoCompatible
();
void
testExclamation
();
void
testExclamation
();
void
testNumbers
();
void
testNumbers
();
void
testDataType
();
void
testDataType
();
...
@@ -47,6 +48,7 @@ namespace
...
@@ -47,6 +48,7 @@ namespace
CPPUNIT_TEST
(
testAlphanum
);
CPPUNIT_TEST
(
testAlphanum
);
CPPUNIT_TEST
(
testComments
);
CPPUNIT_TEST
(
testComments
);
CPPUNIT_TEST
(
testGoto
);
CPPUNIT_TEST
(
testGoto
);
CPPUNIT_TEST
(
testGotoCompatible
);
CPPUNIT_TEST
(
testExclamation
);
CPPUNIT_TEST
(
testExclamation
);
CPPUNIT_TEST
(
testNumbers
);
CPPUNIT_TEST
(
testNumbers
);
CPPUNIT_TEST
(
testDataType
);
CPPUNIT_TEST
(
testDataType
);
...
@@ -62,10 +64,11 @@ namespace
...
@@ -62,10 +64,11 @@ namespace
const
static
rtl
::
OUString
goto_
(
RTL_CONSTASCII_USTRINGPARAM
(
"goto"
));
const
static
rtl
::
OUString
goto_
(
RTL_CONSTASCII_USTRINGPARAM
(
"goto"
));
const
static
rtl
::
OUString
excl
(
RTL_CONSTASCII_USTRINGPARAM
(
"!"
));
const
static
rtl
::
OUString
excl
(
RTL_CONSTASCII_USTRINGPARAM
(
"!"
));
std
::
vector
<
Symbol
>
getSymbols
(
const
rtl
::
OUString
&
source
)
std
::
vector
<
Symbol
>
getSymbols
(
const
rtl
::
OUString
&
source
,
bool
bCompatible
=
false
)
{
{
std
::
vector
<
Symbol
>
symbols
;
std
::
vector
<
Symbol
>
symbols
;
SbiScanner
scanner
(
source
);
SbiScanner
scanner
(
source
);
scanner
.
SetCompatible
(
bCompatible
);
while
(
scanner
.
NextSym
())
while
(
scanner
.
NextSym
())
{
{
Symbol
symbol
;
Symbol
symbol
;
...
@@ -449,6 +452,32 @@ namespace
...
@@ -449,6 +452,32 @@ namespace
CPPUNIT_ASSERT
(
symbols
[
3
].
type
==
SbxVARIANT
);
CPPUNIT_ASSERT
(
symbols
[
3
].
type
==
SbxVARIANT
);
}
}
void
ScannerTest
::
testGotoCompatible
()
{
const
rtl
::
OUString
source1
(
RTL_CONSTASCII_USTRINGPARAM
(
"goto"
));
const
rtl
::
OUString
source2
(
RTL_CONSTASCII_USTRINGPARAM
(
"go to"
));
const
rtl
::
OUString
source3
(
RTL_CONSTASCII_USTRINGPARAM
(
"go
\n
to"
));
std
::
vector
<
Symbol
>
symbols
;
symbols
=
getSymbols
(
source1
,
true
);
CPPUNIT_ASSERT
(
symbols
.
size
()
==
2
);
CPPUNIT_ASSERT
(
symbols
[
0
].
text
==
goto_
);
CPPUNIT_ASSERT
(
symbols
[
1
].
text
==
cr
);
symbols
=
getSymbols
(
source2
,
true
);
CPPUNIT_ASSERT
(
symbols
.
size
()
==
2
);
CPPUNIT_ASSERT
(
symbols
[
0
].
text
==
rtl
::
OUString
(
goto_
));
CPPUNIT_ASSERT
(
symbols
[
1
].
text
==
cr
);
symbols
=
getSymbols
(
source3
,
true
);
CPPUNIT_ASSERT
(
symbols
.
size
()
==
4
);
CPPUNIT_ASSERT
(
symbols
[
0
].
text
==
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"go"
)));
CPPUNIT_ASSERT
(
symbols
[
1
].
text
==
cr
);
CPPUNIT_ASSERT
(
symbols
[
2
].
text
==
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"to"
)));
CPPUNIT_ASSERT
(
symbols
[
3
].
text
==
cr
);
}
void
ScannerTest
::
testExclamation
()
void
ScannerTest
::
testExclamation
()
{
{
const
rtl
::
OUString
source1
(
RTL_CONSTASCII_USTRINGPARAM
(
"asdf!asdf"
));
const
rtl
::
OUString
source1
(
RTL_CONSTASCII_USTRINGPARAM
(
"asdf!asdf"
));
...
...
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