summaryrefslogtreecommitdiff
path: root/libphonenumber/test
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2018-11-20 11:47:05 +0000
committerPaul Duffin <paulduffin@google.com>2018-11-20 14:13:22 +0000
commit174e60f8d8a3adc780565d55013902402344e8b1 (patch)
tree89573f53edf9215f65f08e03c46d0a125804e950 /libphonenumber/test
parent8b412270f9a9c5c066ee7c5854055b3e5ab1335f (diff)
downloadlibphonenumber-174e60f8d8a3adc780565d55013902402344e8b1.tar.gz
Upgrade to 8.9.16
Created using ./update-from-external.sh 8.9.16 m -j32 droid adb reboot bootloader fastboot flashall -w m -j32 cts cts-tradefed run cts -m CtsTelephonyTestCases -t android.telephony.cts.PhoneNumberUtilsTest m -j32 libphonenumber-test vogar dx vogar --timeout 0 \ --classpath ${ANDROID_BUILD_TOP}/out/target/common/obj/JAVA_LIBRARIES/libphonenumber-test_intermediates/classes.jar \ com.google.i18n.phonenumbers Bug: 112782289 Test: see above Change-Id: Ife8d4253a61661ec88157b9995d777fbd2d43ca1
Diffstat (limited to 'libphonenumber/test')
-rw-r--r--libphonenumber/test/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java8
-rw-r--r--libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java19
-rw-r--r--libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java1
-rw-r--r--libphonenumber/test/com/google/i18n/phonenumbers/ShortNumberInfoTest.java2
-rw-r--r--libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RUbin0 -> 285 bytes
5 files changed, 27 insertions, 3 deletions
diff --git a/libphonenumber/test/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java b/libphonenumber/test/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java
index 067f4d24..08851733 100644
--- a/libphonenumber/test/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java
+++ b/libphonenumber/test/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java
@@ -31,10 +31,10 @@ public class CountryCodeToRegionCodeMapForTesting {
// countries sharing a calling code, such as the NANPA countries, the one
// indicated with "isMainCountryForCode" in the metadata should be first.
static Map<Integer, List<String>> getCountryCodeToRegionCodeMap() {
- // The capacity is set to 37 as there are 28 different entries,
+ // The capacity is set to 38 as there are 29 different entries,
// and this offers a load factor of roughly 0.75.
Map<Integer, List<String>> countryCodeToRegionCodeMap =
- new HashMap<Integer, List<String>>(37);
+ new HashMap<Integer, List<String>>(38);
ArrayList<String> listWithRegionCode;
@@ -46,6 +46,10 @@ public class CountryCodeToRegionCodeMapForTesting {
countryCodeToRegionCodeMap.put(1, listWithRegionCode);
listWithRegionCode = new ArrayList<String>(1);
+ listWithRegionCode.add("RU");
+ countryCodeToRegionCodeMap.put(7, listWithRegionCode);
+
+ listWithRegionCode = new ArrayList<String>(1);
listWithRegionCode.add("FR");
countryCodeToRegionCodeMap.put(33, listWithRegionCode);
diff --git a/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java b/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
index 73b46c7f..299c01da 100644
--- a/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
+++ b/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
@@ -2647,6 +2647,22 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
phoneUtil.parse("(800) 901-3355 ,extensio\u0301n 7246433", RegionCode.US));
assertEquals(usWithExtension, phoneUtil.parse("(800) 901-3355 , 7246433", RegionCode.US));
assertEquals(usWithExtension, phoneUtil.parse("(800) 901-3355 ext: 7246433", RegionCode.US));
+ // Testing Russian extension \u0434\u043E\u0431 with variants found online.
+ PhoneNumber ruWithExtension = new PhoneNumber();
+ ruWithExtension.setCountryCode(7).setNationalNumber(4232022511L).setExtension("100");
+ assertEquals(ruWithExtension,
+ phoneUtil.parse("8 (423) 202-25-11, \u0434\u043E\u0431. 100", RegionCode.RU));
+ assertEquals(ruWithExtension,
+ phoneUtil.parse("8 (423) 202-25-11 \u0434\u043E\u0431. 100", RegionCode.RU));
+ assertEquals(ruWithExtension,
+ phoneUtil.parse("8 (423) 202-25-11, \u0434\u043E\u0431 100", RegionCode.RU));
+ assertEquals(ruWithExtension,
+ phoneUtil.parse("8 (423) 202-25-11 \u0434\u043E\u0431 100", RegionCode.RU));
+ assertEquals(ruWithExtension,
+ phoneUtil.parse("8 (423) 202-25-11\u0434\u043E\u0431100", RegionCode.RU));
+ // In upper case
+ assertEquals(ruWithExtension,
+ phoneUtil.parse("8 (423) 202-25-11, \u0414\u041E\u0411. 100", RegionCode.RU));
// Test that if a number has two extensions specified, we ignore the second.
PhoneNumber usWithTwoExtensionsNumber = new PhoneNumber();
@@ -2783,6 +2799,9 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
phoneUtil.isNumberMatch("+64 3 331-6005 extn 1234", "+6433316005#1234"));
assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH,
phoneUtil.isNumberMatch("+64 3 331-6005 ext. 1234", "+6433316005;1234"));
+ assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH,
+ phoneUtil.isNumberMatch("+7 423 202-25-11 ext 100",
+ "+7 4232022511 \u0434\u043E\u0431. 100"));
// Test proto buffers.
assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH,
phoneUtil.isNumberMatch(NZ_NUMBER, "+6403 331 6005"));
diff --git a/libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java b/libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java
index d24c836f..32169f6a 100644
--- a/libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java
+++ b/libphonenumber/test/com/google/i18n/phonenumbers/RegionCode.java
@@ -51,6 +51,7 @@ final class RegionCode {
static final String PG = "PG";
static final String PL = "PL";
static final String RE = "RE";
+ static final String RU = "RU";
static final String SE = "SE";
static final String SG = "SG";
static final String US = "US";
diff --git a/libphonenumber/test/com/google/i18n/phonenumbers/ShortNumberInfoTest.java b/libphonenumber/test/com/google/i18n/phonenumbers/ShortNumberInfoTest.java
index 05865cd2..f76c6842 100644
--- a/libphonenumber/test/com/google/i18n/phonenumbers/ShortNumberInfoTest.java
+++ b/libphonenumber/test/com/google/i18n/phonenumbers/ShortNumberInfoTest.java
@@ -195,7 +195,7 @@ public class ShortNumberInfoTest extends TestMetadataTestCase {
}
public void testGetExampleShortNumber() {
- assertEquals("8711", shortInfo.getExampleShortNumber(RegionCode.AM));
+ assertEquals("110", shortInfo.getExampleShortNumber(RegionCode.AD));
assertEquals("1010", shortInfo.getExampleShortNumber(RegionCode.FR));
assertEquals("", shortInfo.getExampleShortNumber(RegionCode.UN001));
assertEquals("", shortInfo.getExampleShortNumber(null));
diff --git a/libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RU b/libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RU
new file mode 100644
index 00000000..15ed3310
--- /dev/null
+++ b/libphonenumber/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_RU
Binary files differ