diff --git a/iso3166.go b/iso3166.go index a83d791..2ddb4ea 100644 --- a/iso3166.go +++ b/iso3166.go @@ -357,7 +357,7 @@ func GetISO3166() []ISO3166 { i.CountryCode = "86" i.CountryName = "China" i.MobileBeginWith = []string{"13", "14", "15", "16", "17", "18"} - i.PhoneNumberLengths = []int{11} + i.PhoneNumberLengths = []int{10, 11} iso3166Datas = append(iso3166Datas, i) i.Alpha2 = "CI" @@ -1333,7 +1333,7 @@ func GetISO3166() []ISO3166 { i.CountryCode = "51" i.CountryName = "Peru" i.MobileBeginWith = []string{"9"} - i.PhoneNumberLengths = []int{9} + i.PhoneNumberLengths = []int{8, 9} iso3166Datas = append(iso3166Datas, i) i.Alpha2 = "PH" @@ -1832,6 +1832,14 @@ func GetISO3166() []ISO3166 { i.PhoneNumberLengths = []int{7} iso3166Datas = append(iso3166Datas, i) + i.Alpha2 = "XK" + i.Alpha3 = "XKX" + i.CountryCode = "383" + i.CountryName = "Kosovo" + i.MobileBeginWith = []string{"3", "4", "6"} + i.PhoneNumberLengths = []int{8} + iso3166Datas = append(iso3166Datas, i) + i.Alpha2 = "YE" i.Alpha3 = "YEM" i.CountryCode = "967" diff --git a/phonenumber_test.go b/phonenumber_test.go index 3a3b8d3..aaa5603 100644 --- a/phonenumber_test.go +++ b/phonenumber_test.go @@ -19,6 +19,9 @@ var mobFormatTests = []struct { {"(817) 569-8900", "USA", "18175698900"}, {"+371 25 641 580", "LV", "37125641580"}, {"+62 895349866066", "ID", "62895349866066"}, + {"+51 912 640 074", "PE", "51912640074"}, + {"+86 18 855 512 329", "CN", "8618855512329"}, + {"+383 4 555 4999", "XK", "38345554999"}, } func TestFormatMobile(t *testing.T) { @@ -41,6 +44,10 @@ var mobFormatTestsNegative = []struct { {"7499 709 88 33", "RU"}, {"+48 22 (483) 53-34", "PL"}, {"4970523743", "DE"}, + {"51926474", "PE"}, + {"519264112", "PE"}, + {"86178555123", "CN"}, + {"383 9 3334999", "XK"}, } func TestFormatForLandLineIsEmpty(t *testing.T) { @@ -67,6 +74,10 @@ var mobWithLLFormatTests = []struct { {"7499 709 88 33", "RU", "74997098833"}, {"22 (483) 53-34", "PL", "48224835334"}, {"48224835334", "PL", "48224835334"}, + {"+51 (1) 706-19-70", "PE", "5117061970"}, + {"+86 21 85-512-329", "CN", "862185512329"}, + {"+383 9 1234999", "XK", "38391234999"}, + // Mobile numbers {"090 6135 3368", "JP", "819061353368"}, {"+8615948692360", "CN", "8615948692360"}, @@ -74,6 +85,9 @@ var mobWithLLFormatTests = []struct { {"(817) 569-8900", "USA", "18175698900"}, {"+371 25 641 580", "LV", "37125641580"}, {"00371 25 641 580", "LV", "37125641580"}, + {"+51 999 400 500", "PE", "51999400500"}, + {"+86 (16) 855-512-329", "CN", "8616855512329"}, + {"+383 4 1234999", "XK", "38341234999"}, } func TestFormatWithLandLine(t *testing.T) { @@ -98,12 +112,19 @@ var mobWithLLCountryTests = []struct { {"14378869667", "CA"}, {"12836907618", "US"}, {"13406407159", "VI"}, + {"5117061970", "PE"}, + {"862185551232", "CN"}, + {"38391234999", "XK"}, + // Mobile numbers {"39339638066", "IT"}, {"37125641580", "LV"}, {"43663242739", "AT"}, {"21655886170", "TN"}, {"3197010280754", "NL"}, + {"51999400500", "PE"}, + {"8614855512329", "CN"}, + {"38342224999", "XK"}, } func TestGetCountryForMobileNumberWithLandLine(t *testing.T) { @@ -265,6 +286,9 @@ var mobCountryTests = []struct { {"97366622125", "BH", true}, {"59160136560", "BO", true}, {"59168295570", "BO", true}, + {"51907061970", "PE", true}, + {"8613855512329", "CN", true}, + {"38361234999", "XK", true}, } func TestGetCountryForMobileNumber(t *testing.T) {