From 29827fde524a42fe343b32ea3c2f543e9ed3ee55 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 15 Feb 2020 03:27:02 +0300 Subject: Release version 65.1.0+1 Drop copyright notice from source code Convert libicuuc test from C to C++ so it can link library statically Drop linking -lpthread and -lm for MinGW GCC --- libicuuc/tests/basic/buildfile | 3 +- libicuuc/tests/basic/driver.c | 86 ------------------------------------ libicuuc/tests/basic/driver.cpp | 85 +++++++++++++++++++++++++++++++++++ libicuuc/tests/basic/testscript | 1 - libicuuc/tests/build/bootstrap.build | 1 - libicuuc/tests/build/root.build | 19 ++++---- libicuuc/tests/buildfile | 1 - 7 files changed, 96 insertions(+), 100 deletions(-) delete mode 100644 libicuuc/tests/basic/driver.c create mode 100644 libicuuc/tests/basic/driver.cpp (limited to 'libicuuc/tests') diff --git a/libicuuc/tests/basic/buildfile b/libicuuc/tests/basic/buildfile index 6934b21..2189aa6 100644 --- a/libicuuc/tests/basic/buildfile +++ b/libicuuc/tests/basic/buildfile @@ -1,7 +1,6 @@ # file : tests/basic/buildfile -# copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC # license : Unicode License; see accompanying LICENSE file import libs = libicuuc%lib{icuuc} -exe{driver}: {h c}{*} $libs testscript +exe{driver}: {hxx cxx}{*} $libs testscript diff --git a/libicuuc/tests/basic/driver.c b/libicuuc/tests/basic/driver.c deleted file mode 100644 index 92c2b7c..0000000 --- a/libicuuc/tests/basic/driver.c +++ /dev/null @@ -1,86 +0,0 @@ -/* file : tests/basic/driver.c - * copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC - * license : Unicode License; see accompanying LICENSE file - */ -#include -#include - -#include -#include -#include -#include -#include - -/* Usage: argv[0] - * - * Test some basic libicuuc functionality: - * - * - query and print the library version - * - set, query and print the default locale - * - load a portion of the bundled data and print its format id/version - */ -int -main () -{ - /* Print version. - */ - UVersionInfo v; - u_getVersion (v); - - char s[U_MAX_VERSION_STRING_LENGTH]; - u_versionToString (v, s); - - printf ("version: %s\n", s); - - /* Change and print the current locale. - */ - UErrorCode e = U_ZERO_ERROR; - - uloc_setDefault ("en_GB", &e); - - if (U_FAILURE (e)) - { - fprintf (stderr, "uloc_setDefault failed: %s\n", u_errorName (e)); - u_cleanup (); - return 1; - } - - printf ("locale: %s\n", uloc_getDefault ()); - - /* Check that data is properly loaded from the libicudata's data bundle and - * print its format id/version. - */ - UDataMemory* d = udata_open (NULL, "res", "en_US", &e); - - if (U_FAILURE (e)) - { - fprintf (stderr, "udata_open failed: %s\n", u_errorName (e)); - u_cleanup (); - return 1; - } - - UDataInfo i; - i.size = sizeof (UDataInfo); - - udata_getInfo (d, &i); - - assert (i.isBigEndian == U_IS_BIG_ENDIAN); - assert (i.charsetFamily == U_CHARSET_FAMILY); - - printf ("data: %.4s/%u.%u.%u.%u %u.%u.%u.%u\n", - i.dataFormat, - i.formatVersion[0], - i.formatVersion[1], - i.formatVersion[2], - i.formatVersion[3], - i.dataVersion[0], - i.dataVersion[1], - i.dataVersion[2], - i.dataVersion[3]); - - udata_close (d); - - u_cleanup (); - - return 0; -} diff --git a/libicuuc/tests/basic/driver.cpp b/libicuuc/tests/basic/driver.cpp new file mode 100644 index 0000000..a273133 --- /dev/null +++ b/libicuuc/tests/basic/driver.cpp @@ -0,0 +1,85 @@ +// file : tests/basic/driver.cpp +// license : Unicode License; see accompanying LICENSE file + +#include +#include + +#include +#include +#include +#include +#include + +// Usage: argv[0] +// +// Test some basic libicuuc functionality: +// +// - query and print the library version +// - set, query and print the default locale +// - load a portion of the bundled data and print its format id/version + +int +main () +{ + // Print version. + // + UVersionInfo v; + u_getVersion (v); + + char s[U_MAX_VERSION_STRING_LENGTH]; + u_versionToString (v, s); + + printf ("version: %s\n", s); + + // Change and print the current locale. + // + UErrorCode e = U_ZERO_ERROR; + + uloc_setDefault ("en_GB", &e); + + if (U_FAILURE (e)) + { + fprintf (stderr, "uloc_setDefault failed: %s\n", u_errorName (e)); + u_cleanup (); + return 1; + } + + printf ("locale: %s\n", uloc_getDefault ()); + + // Check that data is properly loaded from the libicudata's data bundle and + // print its format id/version. + // + UDataMemory* d = udata_open (NULL, "res", "en_US", &e); + + if (U_FAILURE (e)) + { + fprintf (stderr, "udata_open failed: %s\n", u_errorName (e)); + u_cleanup (); + return 1; + } + + UDataInfo i; + i.size = sizeof (UDataInfo); + + udata_getInfo (d, &i); + + assert (i.isBigEndian == U_IS_BIG_ENDIAN); + assert (i.charsetFamily == U_CHARSET_FAMILY); + + printf ("data: %.4s/%u.%u.%u.%u %u.%u.%u.%u\n", + i.dataFormat, + i.formatVersion[0], + i.formatVersion[1], + i.formatVersion[2], + i.formatVersion[3], + i.dataVersion[0], + i.dataVersion[1], + i.dataVersion[2], + i.dataVersion[3]); + + udata_close (d); + + u_cleanup (); + + return 0; +} diff --git a/libicuuc/tests/basic/testscript b/libicuuc/tests/basic/testscript index 72fbe00..2578551 100644 --- a/libicuuc/tests/basic/testscript +++ b/libicuuc/tests/basic/testscript @@ -1,5 +1,4 @@ # file : tests/basic/testscript -# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd # license : Unicode License; see accompanying LICENSE file $* >>~%EOO% diff --git a/libicuuc/tests/build/bootstrap.build b/libicuuc/tests/build/bootstrap.build index 17797c1..b689bd5 100644 --- a/libicuuc/tests/build/bootstrap.build +++ b/libicuuc/tests/build/bootstrap.build @@ -1,5 +1,4 @@ # file : tests/build/bootstrap.build -# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd # license : Unicode License; see accompanying LICENSE file project = # Unnamed subproject. diff --git a/libicuuc/tests/build/root.build b/libicuuc/tests/build/root.build index be01522..76b5bd7 100644 --- a/libicuuc/tests/build/root.build +++ b/libicuuc/tests/build/root.build @@ -1,17 +1,18 @@ # file : tests/build/root.build -# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd # license : Unicode License; see accompanying LICENSE file -using c +cxx.std = latest -h{*}: extension = h -c{*}: extension = c +using cxx -if ($c.target.system == 'win32-msvc') - c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS +hxx{*}: extension = h +cxx{*}: extension = cpp -if ($c.class == 'msvc') - c.coptions += /wd4251 /wd4275 /wd4800 +if ($cxx.target.system == 'win32-msvc') + cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS + +if ($cxx.class == 'msvc') + cxx.coptions += /wd4251 /wd4275 /wd4800 # Every exe{} in this subproject is by default a test. # @@ -19,4 +20,4 @@ exe{*}: test = true # Specify the test target for cross-testing. # -test.target = $c.target +test.target = $cxx.target diff --git a/libicuuc/tests/buildfile b/libicuuc/tests/buildfile index d976635..78b2b2a 100644 --- a/libicuuc/tests/buildfile +++ b/libicuuc/tests/buildfile @@ -1,5 +1,4 @@ # file : tests/buildfile -# copyright : Copyright (c) 2016-2019 Code Synthesis Ltd # license : Unicode License; see accompanying LICENSE file ./: {*/ -build/} -- cgit v1.1