From 53d5ba61a76fd9d842a05234c182de99351a560d Mon Sep 17 00:00:00 2001 From: Younies Date: Thu, 16 Jan 2020 17:16:19 +0100 Subject: [PATCH] skeleton for unit test in icu --- icu4c/source/test/intltest/Makefile.in | 3 +- icu4c/source/test/intltest/intltest.vcxproj | 1 + .../test/intltest/intltest.vcxproj.filters | 3 ++ icu4c/source/test/intltest/itformat.cpp | 10 +++++ icu4c/source/test/intltest/unitstest.cpp | 40 +++++++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 icu4c/source/test/intltest/unitstest.cpp diff --git a/icu4c/source/test/intltest/Makefile.in b/icu4c/source/test/intltest/Makefile.in index bcab2c98ba2..594d491f6f7 100644 --- a/icu4c/source/test/intltest/Makefile.in +++ b/icu4c/source/test/intltest/Makefile.in @@ -68,7 +68,8 @@ numbertest_modifiers.o numbertest_patternmodifier.o numbertest_patternstring.o \ string_segment_test.o \ numbertest_parse.o numbertest_doubleconversion.o numbertest_skeletons.o \ static_unisets_test.o numfmtdatadriventest.o numbertest_range.o erarulestest.o \ -formattedvaluetest.o formatted_string_builder_test.o numbertest_permutation.o +formattedvaluetest.o formatted_string_builder_test.o numbertest_permutation.o \ +unitstest.o DEPS = $(OBJECTS:.o=.d) diff --git a/icu4c/source/test/intltest/intltest.vcxproj b/icu4c/source/test/intltest/intltest.vcxproj index dbdb3e0f06c..8d0dc75689e 100644 --- a/icu4c/source/test/intltest/intltest.vcxproj +++ b/icu4c/source/test/intltest/intltest.vcxproj @@ -301,6 +301,7 @@ + diff --git a/icu4c/source/test/intltest/intltest.vcxproj.filters b/icu4c/source/test/intltest/intltest.vcxproj.filters index 0bf336b01ab..f068ff80e7f 100644 --- a/icu4c/source/test/intltest/intltest.vcxproj.filters +++ b/icu4c/source/test/intltest/intltest.vcxproj.filters @@ -550,6 +550,9 @@ locales & resources + + formatting + diff --git a/icu4c/source/test/intltest/itformat.cpp b/icu4c/source/test/intltest/itformat.cpp index 870728a9a0a..9126d528fa2 100644 --- a/icu4c/source/test/intltest/itformat.cpp +++ b/icu4c/source/test/intltest/itformat.cpp @@ -74,6 +74,7 @@ extern IntlTest *createScientificNumberFormatterTest(); extern IntlTest *createFormattedValueTest(); extern IntlTest *createFormattedStringBuilderTest(); extern IntlTest *createStringSegmentTest(); +extern IntlTest *createUnitsTest(); #define TESTCLASS(id, TestClass) \ @@ -247,6 +248,15 @@ void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &nam callTest(*test, par); } break; + case 56: + name = "UnitsTest"; + if (exec) { + logln("UnitsTest test---"); + logln((UnicodeString)""); + LocalPointer test(createUnitsTest()); + callTest(*test, par); + } + break; default: name = ""; break; //needed to end loop } if (exec) { diff --git a/icu4c/source/test/intltest/unitstest.cpp b/icu4c/source/test/intltest/unitstest.cpp new file mode 100644 index 00000000000..c0d52d314cb --- /dev/null +++ b/icu4c/source/test/intltest/unitstest.cpp @@ -0,0 +1,40 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html#License + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "intltest.h" + + +class UnitsTest : public IntlTest { +public: + UnitsTest() {} + + void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL); + + void testBasic(); +}; + +extern IntlTest *createUnitsTest() { + return new UnitsTest(); +} + +void UnitsTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char * /*par*/) { + if(exec) { + logln("TestSuite UnitsTest: "); + } + TESTCASE_AUTO_BEGIN; + TESTCASE_AUTO(testBasic); + TESTCASE_AUTO_END; +} + +void UnitsTest::testBasic() { + IcuTestErrorCode status(*this, "testBasic"); + + assertEquals("message", 1, 2); +} + + +#endif // !UCONFIG_NO_FORMATTING -- 2.40.0