Skip to content

Commit

Permalink
Closes #687
Browse files Browse the repository at this point in the history
Update German Mobile Phone Numbers
  • Loading branch information
TrevorPilley committed Aug 8, 2024
1 parent c09a4c0 commit 4b3502d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 23 deletions.
18 changes: 14 additions & 4 deletions src/PhoneNumbers/DataFiles/DE.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
N|15020||000000-999999|M
M|15050,15080,15555,15630,15678,15888||000000-999999|
M|160||0000000-99999999|
M|162-163,170-175,177-179,1511-1512,1514-1517,1520-1523,1525-1526,1529,1570,1573,1575,1577-1579,1590||0000000-9999999|
# Reference: https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000510006PDFE.pdf
# Reference Date: 25/08/2022
N|137||0000000-9999999|
M|15019,15180-15181,15310,15510-15511,15566,15630,15678-15679,15888||000000-999999|
M|1511-1512,1514-1517,1520-1523,1525-1526,1529,1570,1573,1575,1577-1579,1590||0000000-9999999|
M|160||0000000-8999999|
M|1609,162-163,170-175,177-179||0000000-9999999|
M|164||0-9999999999|P
M|168-169||0-99999999999|P
M|176||00000000-99999999|
N|180||00000-9999999|
N|181||00000-99999999999|
N|182-189||00000000-99999999|
N|191-194||0-999|
N|1986-1987||000-999|
N|1988-1989||00-99|
N|19890||00-99|
G|201|Essen|000-99999999|
G|202|Wuppertal|000-99999999|
G|203|Duisburg|000-99999999|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ public class DefaultPhoneNumberParserTests_DE_MobilePhoneNumber
private static readonly PhoneNumberParser s_parser = DefaultPhoneNumberParser.Create(CountryInfo.Germany);

[Theory]
[InlineData("015050000000", "15050", "000000")]
[InlineData("015050999999", "15050", "999999")]
[InlineData("015080000000", "15080", "000000")]
[InlineData("015080999999", "15080", "999999")]
[InlineData("015019000000", "15019", "000000")]
[InlineData("015019999999", "15019", "999999")]
[InlineData("015110000000", "1511", "0000000")]
[InlineData("015119999999", "1511", "9999999")]
[InlineData("015120000000", "1512", "0000000")]
Expand All @@ -20,6 +18,10 @@ public class DefaultPhoneNumberParserTests_DE_MobilePhoneNumber
[InlineData("015149999999", "1514", "9999999")]
[InlineData("015170000000", "1517", "0000000")]
[InlineData("015179999999", "1517", "9999999")]
[InlineData("015180000000", "15180", "000000")]
[InlineData("015180999999", "15180", "999999")]
[InlineData("015181000000", "15181", "000000")]
[InlineData("015181999999", "15181", "999999")]
[InlineData("015200000000", "1520", "0000000")]
[InlineData("015209999999", "1520", "9999999")]
[InlineData("015230000000", "1523", "0000000")]
Expand All @@ -30,12 +32,20 @@ public class DefaultPhoneNumberParserTests_DE_MobilePhoneNumber
[InlineData("015269999999", "1526", "9999999")]
[InlineData("015290000000", "1529", "0000000")]
[InlineData("015299999999", "1529", "9999999")]
[InlineData("015555000000", "15555", "000000")]
[InlineData("015555999999", "15555", "999999")]
[InlineData("015310000000", "15310", "000000")]
[InlineData("015310999999", "15310", "999999")]
[InlineData("015510000000", "15510", "000000")]
[InlineData("015510999999", "15510", "999999")]
[InlineData("015511000000", "15511", "000000")]
[InlineData("015511999999", "15511", "999999")]
[InlineData("015566000000", "15566", "000000")]
[InlineData("015566999999", "15566", "999999")]
[InlineData("015630000000", "15630", "000000")]
[InlineData("015630999999", "15630", "999999")]
[InlineData("015678000000", "15678", "000000")]
[InlineData("015678999999", "15678", "999999")]
[InlineData("015679000000", "15679", "000000")]
[InlineData("015679999999", "15679", "999999")]
[InlineData("015700000000", "1570", "0000000")]
[InlineData("015709999999", "1570", "9999999")]
[InlineData("015730000000", "1573", "0000000")]
Expand Down Expand Up @@ -70,7 +80,9 @@ public void Parse_Known_MobilePhoneNumber_15XXX_NationalDestinationCode(string v

[Theory]
[InlineData("01600000000", "160", "0000000")]
[InlineData("016099999999", "160", "99999999")]
[InlineData("01608999999", "160", "8999999")]
[InlineData("016090000000", "1609", "0000000")]
[InlineData("016099999999", "1609", "9999999")]
[InlineData("01620000000", "162", "0000000")]
[InlineData("01629999999", "162", "9999999")]
[InlineData("01630000000", "163", "0000000")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,31 @@ public class DefaultPhoneNumberParserTests_DE_NonGeographicPhoneNumber
private static readonly PhoneNumberParser s_parser = DefaultPhoneNumberParser.Create(CountryInfo.Germany);

[Theory]
[InlineData("032000000000", "32", "000000000")]
[InlineData("03299999999999", "32", "99999999999")]
public void Parse_Known_NonGeographicPhoneNumber_3X_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
[InlineData("01370000000", "137", "0000000")]
[InlineData("01379999999", "137", "9999999")]
[InlineData("018000000", "180", "00000")]
[InlineData("01809999999", "180", "9999999")]
[InlineData("018100000", "181", "00000")]
[InlineData("018199999999999", "181", "99999999999")]
[InlineData("018200000000", "182", "00000000")]
[InlineData("018299999999", "182", "99999999")]
[InlineData("018900000000", "189", "00000000")]
[InlineData("018999999999", "189", "99999999")]
[InlineData("01910", "191", "0")]
[InlineData("0191999", "191", "999")]
[InlineData("01940", "194", "0")]
[InlineData("0194999", "194", "999")]
[InlineData("01986000", "1986", "000")]
[InlineData("01986999", "1986", "999")]
[InlineData("01987000", "1987", "000")]
[InlineData("01987999", "1987", "999")]
[InlineData("0198800", "1988", "00")]
[InlineData("0198899", "1988", "99")]
[InlineData("0198900", "1989", "00")]
[InlineData("0198999", "1989", "99")]
[InlineData("01989000", "19890", "00")]
[InlineData("01989099", "19890", "99")]
public void Parse_Known_NonGeographicPhoneNumber_1XX_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
{
var parseResult = s_parser.Parse(value);
parseResult.ThrowIfFailure();
Expand All @@ -31,9 +53,9 @@ public void Parse_Known_NonGeographicPhoneNumber_3X_NationalDestinationCode(stri
}

[Theory]
[InlineData("08000000000", "800", "0000000")]
[InlineData("08009999999", "800", "9999999")]
public void Parse_Known_NonGeographicPhoneNumber_Freephone(string value, string NationalDestinationCode, string subscriberNumber)
[InlineData("032000000000", "32", "000000000")]
[InlineData("03299999999999", "32", "99999999999")]
public void Parse_Known_NonGeographicPhoneNumber_3X_NationalDestinationCode(string value, string NationalDestinationCode, string subscriberNumber)
{
var parseResult = s_parser.Parse(value);
parseResult.ThrowIfFailure();
Expand All @@ -45,7 +67,7 @@ public void Parse_Known_NonGeographicPhoneNumber_Freephone(string value, string

var nonGeographicPhoneNumber = (NonGeographicPhoneNumber)phoneNumber;
Assert.Equal(CountryInfo.Germany, nonGeographicPhoneNumber.Country);
Assert.True(nonGeographicPhoneNumber.IsFreephone);
Assert.False(nonGeographicPhoneNumber.IsFreephone);
Assert.False(nonGeographicPhoneNumber.IsMachineToMachine);
Assert.False(nonGeographicPhoneNumber.IsPremiumRate);
Assert.False(nonGeographicPhoneNumber.IsSharedCost);
Expand All @@ -54,9 +76,9 @@ public void Parse_Known_NonGeographicPhoneNumber_Freephone(string value, string
}

[Theory]
[InlineData("015020000000", "15020", "000000")]
[InlineData("015020999999", "15020", "999999")]
public void Parse_Known_NonGeographicPhoneNumber_MachineToMachine(string value, string NationalDestinationCode, string subscriberNumber)
[InlineData("08000000000", "800", "0000000")]
[InlineData("08009999999", "800", "9999999")]
public void Parse_Known_NonGeographicPhoneNumber_Freephone(string value, string NationalDestinationCode, string subscriberNumber)
{
var parseResult = s_parser.Parse(value);
parseResult.ThrowIfFailure();
Expand All @@ -68,8 +90,8 @@ public void Parse_Known_NonGeographicPhoneNumber_MachineToMachine(string value,

var nonGeographicPhoneNumber = (NonGeographicPhoneNumber)phoneNumber;
Assert.Equal(CountryInfo.Germany, nonGeographicPhoneNumber.Country);
Assert.False(nonGeographicPhoneNumber.IsFreephone);
Assert.True(nonGeographicPhoneNumber.IsMachineToMachine);
Assert.True(nonGeographicPhoneNumber.IsFreephone);
Assert.False(nonGeographicPhoneNumber.IsMachineToMachine);
Assert.False(nonGeographicPhoneNumber.IsPremiumRate);
Assert.False(nonGeographicPhoneNumber.IsSharedCost);
Assert.Equal(NationalDestinationCode, nonGeographicPhoneNumber.NationalDestinationCode);
Expand Down

0 comments on commit 4b3502d

Please sign in to comment.