"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "source/test/intltest/localematchertest.cpp" between
icu4c-67rc-src.tgz and icu4c-67_1-src.tgz

About: ICU (International Components for Unicode) is a set of C/C++ and Java libraries providing Unicode and Globalization support for software applications on a wide variety of platforms.

localematchertest.cpp  (icu4c-67rc-src.tgz):localematchertest.cpp  (icu4c-67_1-src.tgz)
// © 2019 and later: Unicode, Inc. and others. // © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License // License & terms of use: http://www.unicode.org/copyright.html#License
// localematchertest.cpp // localematchertest.cpp
// created: 2019jul04 Markus W. Scherer // created: 2019jul04 Markus W. Scherer
#include <string> #include <string>
#include <vector> #include <vector>
#include <utility>
#include "unicode/utypes.h" #include "unicode/utypes.h"
#include "unicode/localematcher.h" #include "unicode/localematcher.h"
#include "unicode/locid.h" #include "unicode/locid.h"
#include "charstr.h" #include "charstr.h"
#include "cmemory.h" #include "cmemory.h"
#include "intltest.h" #include "intltest.h"
#include "localeprioritylist.h" #include "localeprioritylist.h"
#include "ucbuf.h" #include "ucbuf.h"
skipping to change at line 336 skipping to change at line 337
void LocaleMatcherTest::testDirection() { void LocaleMatcherTest::testDirection() {
IcuTestErrorCode errorCode(*this, "testDirection"); IcuTestErrorCode errorCode(*this, "testDirection");
Locale supported[] = { "ar", "nn" }; Locale supported[] = { "ar", "nn" };
Locale desired[] = { "arz-EG", "nb-DK" }; Locale desired[] = { "arz-EG", "nb-DK" };
LocaleMatcher::Builder builder; LocaleMatcher::Builder builder;
builder.setSupportedLocales(ARRAY_RANGE(supported)); builder.setSupportedLocales(ARRAY_RANGE(supported));
{ {
// arz is a close one-way match to ar, and the region matches. // arz is a close one-way match to ar, and the region matches.
// (Egyptian Arabic vs. Arabic) // (Egyptian Arabic vs. Arabic)
LocaleMatcher withOneWay = builder.build(errorCode); // Also explicitly exercise the move copy constructor.
LocaleMatcher built = builder.build(errorCode);
LocaleMatcher withOneWay(std::move(built));
Locale::RangeIterator<Locale *> desiredIter(ARRAY_RANGE(desired)); Locale::RangeIterator<Locale *> desiredIter(ARRAY_RANGE(desired));
assertEquals("with one-way", "ar", assertEquals("with one-way", "ar",
locString(withOneWay.getBestMatch(desiredIter, errorCode))) ; locString(withOneWay.getBestMatch(desiredIter, errorCode))) ;
} }
{ {
// nb is a less close two-way match to nn, and the regions differ. // nb is a less close two-way match to nn, and the regions differ.
// (Norwegian Bokmal vs. Nynorsk) // (Norwegian Bokmal vs. Nynorsk)
LocaleMatcher onlyTwoWay = // Also explicitly exercise the move assignment operator.
LocaleMatcher onlyTwoWay = builder.build(errorCode);
LocaleMatcher built =
builder.setDirection(ULOCMATCH_DIRECTION_ONLY_TWO_WAY).build(errorCo de); builder.setDirection(ULOCMATCH_DIRECTION_ONLY_TWO_WAY).build(errorCo de);
onlyTwoWay = std::move(built);
Locale::RangeIterator<Locale *> desiredIter(ARRAY_RANGE(desired)); Locale::RangeIterator<Locale *> desiredIter(ARRAY_RANGE(desired));
assertEquals("only two-way", "nn", assertEquals("only two-way", "nn",
locString(onlyTwoWay.getBestMatch(desiredIter, errorCode))) ; locString(onlyTwoWay.getBestMatch(desiredIter, errorCode))) ;
} }
} }
void LocaleMatcherTest::testMatch() { void LocaleMatcherTest::testMatch() {
IcuTestErrorCode errorCode(*this, "testMatch"); IcuTestErrorCode errorCode(*this, "testMatch");
LocaleMatcher matcher = LocaleMatcher::Builder().build(errorCode); LocaleMatcher matcher = LocaleMatcher::Builder().build(errorCode);
 End of changes. 4 change blocks. 
2 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)