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
92c4e2f2
Kaydet (Commit)
92c4e2f2
authored
Eyl 01, 2015
tarafından
Damjan Jovanovic
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#i125003# migrate main/sal/qa/rtl/math from cppunit to Google Test.
üst
802a2d56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
45 deletions
+41
-45
makefile.mk
sal/qa/rtl/math/makefile.mk
+13
-11
test-rtl-math.cxx
sal/qa/rtl/math/test-rtl-math.cxx
+28
-34
No files found.
sal/qa/rtl/math/makefile.mk
Dosyayı görüntüle @
92c4e2f2
...
...
@@ -33,19 +33,21 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE
:
settings.mk
CFLAGSCXX
+=
$(CPPUNIT_CFLAGS)
.IF
"$(ENABLE_UNIT_TESTS)"
!=
"YES"
all
:
@echo
unit
tests
are
disabled.
Nothing
to
do.
.ELSE
SHL1IMPLIB
=
i
$(SHL1TARGET)
SHL1OBJS
=
$(SLO)
/test-rtl-math.obj
SHL1RPATH
=
NONE
SHL1STDLIBS
=
$(CPPUNITLIB)
$(SALLIB)
SHL1TARGET
=
test-rtl-math
SHL1VERSIONMAP
=
$(PRJ)
/qa/export.map
DEF1NAME
=
$(SHL1TARGET)
SLOFILES
=
$(SHL1OBJS)
APP1OBJS
=
$(SLO)
/test-rtl-math.obj
APP1RPATH
=
NONE
APP1STDLIBS
=
$(GTESTLIB)
$(SALLIB)
APP1TARGET
=
test-rtl-math
APP1TEST
=
enabled
.INCLUDE
:
target.mk
.INCLUDE
:
_cppunit.mk
.END
.ENDIF
# "$(ENABLE_UNIT_TESTS)" != "YES"
.END
# "$(OOO_SUBSEQUENT_TESTS)" == ""
sal/qa/rtl/math/test-rtl-math.cxx
Dosyayı görüntüle @
92c4e2f2
...
...
@@ -24,10 +24,7 @@
#include "precompiled_sal.hxx"
#include "sal/config.h"
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
#include "gtest/gtest.h"
#include "rtl/math.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
...
...
@@ -35,38 +32,35 @@
namespace
{
class
Test
:
public
CppUnit
::
TestFixture
{
public
:
void
test_stringToDouble_good
()
{
rtl_math_ConversionStatus
status
;
sal_Int32
end
;
double
res
=
rtl
::
math
::
stringToDouble
(
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
" +1.E01foo"
)),
sal_Unicode
(
'.'
),
sal_Unicode
(
','
),
&
status
,
&
end
);
CPPUNIT_ASSERT_EQUAL
(
rtl_math_ConversionStatus_Ok
,
status
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
RTL_CONSTASCII_LENGTH
(
" +1.E01"
)),
end
);
CPPUNIT_ASSERT_EQUAL
(
10.0
,
res
);
}
void
test_stringToDouble_bad
()
{
rtl_math_ConversionStatus
status
;
sal_Int32
end
;
double
res
=
rtl
::
math
::
stringToDouble
(
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
" +Efoo"
)),
sal_Unicode
(
'.'
),
sal_Unicode
(
','
),
&
status
,
&
end
);
CPPUNIT_ASSERT_EQUAL
(
rtl_math_ConversionStatus_Ok
,
status
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
end
);
CPPUNIT_ASSERT_EQUAL
(
0.0
,
res
);
}
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST
(
test_stringToDouble_good
);
CPPUNIT_TEST
(
test_stringToDouble_bad
);
CPPUNIT_TEST_SUITE_END
();
class
Test
:
public
::
testing
::
Test
{
};
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
TEST_F
(
Test
,
test_stringToDouble_good
)
{
rtl_math_ConversionStatus
status
;
sal_Int32
end
;
double
res
=
rtl
::
math
::
stringToDouble
(
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
" +1.E01foo"
)),
sal_Unicode
(
'.'
),
sal_Unicode
(
','
),
&
status
,
&
end
);
ASSERT_EQ
(
rtl_math_ConversionStatus_Ok
,
status
);
ASSERT_EQ
(
sal_Int32
(
RTL_CONSTASCII_LENGTH
(
" +1.E01"
)),
end
);
ASSERT_EQ
(
10.0
,
res
);
}
TEST_F
(
Test
,
test_stringToDouble_bad
)
{
rtl_math_ConversionStatus
status
;
sal_Int32
end
;
double
res
=
rtl
::
math
::
stringToDouble
(
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
" +Efoo"
)),
sal_Unicode
(
'.'
),
sal_Unicode
(
','
),
&
status
,
&
end
);
ASSERT_EQ
(
rtl_math_ConversionStatus_Ok
,
status
);
ASSERT_EQ
(
sal_Int32
(
0
),
end
);
ASSERT_EQ
(
0.0
,
res
);
}
}
CPPUNIT_PLUGIN_IMPLEMENT
();
int
main
(
int
argc
,
char
**
argv
)
{
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
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