diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..ba8cb78 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-t4": { + "version": "3.0.0", + "commands": [ + "t4" + ] + } + } +} diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 398b6e7..b090bb4 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -13,14 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup .NET Core 2.2 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 2.2.x - - name: Setup .NET Core 3.1 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 3.1.x - name: Setup .NET 6 uses: actions/setup-dotnet@v3 with: @@ -29,6 +21,20 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x + - name: Setup .NET 9 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 9.0.x + - name: Setup .NET 10 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 10.0.x + - name: Restore dotnet tools + run: dotnet tool restore + - name: Regenerate from T4 + run: dotnet t4 src/PostalCodes/Generated/PostalCodeFactory.gen.tt + - name: Verify no drift + run: git diff --exit-code - name: Build with dotnet run: dotnet build --configuration Release /p:ContinuousIntegrationBuild=true - name: Test diff --git a/src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj b/src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj index 9dcce9c..e2d8b32 100644 --- a/src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj +++ b/src/PostalCodes.UnitTests/PostalCodes.UnitTests.csproj @@ -1,6 +1,6 @@  - netcoreapp2.2;netcoreapp3.1;net6.0;net8.0 + net6.0;net8.0;net9.0;net10.0 diff --git a/src/PostalCodes/Generated/PostalCodeFactory.gen.cs b/src/PostalCodes/Generated/PostalCodeFactory.gen.cs index 939b32f..561892f 100644 --- a/src/PostalCodes/Generated/PostalCodeFactory.gen.cs +++ b/src/PostalCodes/Generated/PostalCodeFactory.gen.cs @@ -1,4 +1,4 @@ -using System; +using System; using PostalCodes.GenericPostalCodes; namespace PostalCodes @@ -38,20 +38,6 @@ public PostalCode CreatePostalCode(Country country, string postalCode) postalCode = postalCode.ToUpper(); switch(country.Code) { - case "FO" : - return new FOPostalCode(postalCode); - case "IS" : - return new ISPostalCode(postalCode); - case "LS" : - return new LSPostalCode(postalCode); - case "MG" : - return new MGPostalCode(postalCode); - case "OM" : - return new OMPostalCode(postalCode); - case "PG" : - return new PGPostalCode(postalCode); - case "PS" : - return new PSPostalCode(postalCode); case "AF" : return new AFPostalCode(postalCode); case "AL" : @@ -60,10 +46,16 @@ public PostalCode CreatePostalCode(Country country, string postalCode) return new AMPostalCode(postalCode); case "AR" : return new ARPostalCode(postalCode); + case "AS" : + return new ASPostalCode(postalCode); case "AT" : return new ATPostalCode(postalCode); case "AU" : return new AUPostalCode(postalCode); + case "BA" : + return new BAPostalCode(postalCode); + case "BB" : + return new BBPostalCode(postalCode); case "BD" : return new BDPostalCode(postalCode); case "BE" : @@ -72,120 +64,120 @@ public PostalCode CreatePostalCode(Country country, string postalCode) return new BGPostalCode(postalCode); case "BO" : return new BOPostalCode(postalCode); + case "BT" : + return new BTPostalCode(postalCode); + case "BY" : + return new BYPostalCode(postalCode); + case "CA" : + return new CAPostalCode(postalCode); case "CC" : return new CCPostalCode(postalCode); case "CH" : return new CHPostalCode(postalCode); + case "CN" : + return new CNPostalCode(postalCode); + case "CO" : + return new COPostalCode(postalCode); + case "CR" : + return new CRPostalCode(postalCode); + case "CU" : + return new CUPostalCode(postalCode); case "CV" : return new CVPostalCode(postalCode); case "CX" : return new CXPostalCode(postalCode); case "CY" : return new CYPostalCode(postalCode); - case "DK" : - return new DKPostalCode(postalCode); - case "ET" : - return new ETPostalCode(postalCode); - case "GE" : - return new GEPostalCode(postalCode); - case "GL" : - return new GLPostalCode(postalCode); - case "GW" : - return new GWPostalCode(postalCode); - case "HM" : - return new HMPostalCode(postalCode); - case "HT" : - return new HTPostalCode(postalCode); - case "HU" : - return new HUPostalCode(postalCode); - case "LI" : - return new LIPostalCode(postalCode); - case "LR" : - return new LRPostalCode(postalCode); - case "LU" : - return new LUPostalCode(postalCode); - case "MK" : - return new MKPostalCode(postalCode); - case "MZ" : - return new MZPostalCode(postalCode); - case "NE" : - return new NEPostalCode(postalCode); - case "NF" : - return new NFPostalCode(postalCode); - case "NO" : - return new NOPostalCode(postalCode); - case "NZ" : - return new NZPostalCode(postalCode); - case "PH" : - return new PHPostalCode(postalCode); - case "PY" : - return new PYPostalCode(postalCode); - case "SI" : - return new SIPostalCode(postalCode); - case "SJ" : - return new SJPostalCode(postalCode); - case "TN" : - return new TNPostalCode(postalCode); - case "ZA" : - return new ZAPostalCode(postalCode); - case "AS" : - return new ASPostalCode(postalCode); - case "BA" : - return new BAPostalCode(postalCode); - case "BT" : - return new BTPostalCode(postalCode); - case "CR" : - return new CRPostalCode(postalCode); - case "CU" : - return new CUPostalCode(postalCode); case "CZ" : return new CZPostalCode(postalCode); case "DE" : return new DEPostalCode(postalCode); + case "DK" : + return new DKPostalCode(postalCode); case "DO" : return new DOPostalCode(postalCode); case "DZ" : return new DZPostalCode(postalCode); + case "EC" : + return new ECPostalCode(postalCode); case "EE" : return new EEPostalCode(postalCode); case "EG" : return new EGPostalCode(postalCode); case "ES" : return new ESPostalCode(postalCode); + case "ET" : + return new ETPostalCode(postalCode); case "FI" : return new FIPostalCode(postalCode); case "FM" : return new FMPostalCode(postalCode); + case "FO" : + return new FOPostalCode(postalCode); case "FR" : return new FRPostalCode(postalCode); + case "GB" : + return new GBPostalCode(postalCode); + case "GE" : + return new GEPostalCode(postalCode); + case "GL" : + return new GLPostalCode(postalCode); case "GR" : return new GRPostalCode(postalCode); case "GT" : return new GTPostalCode(postalCode); case "GU" : return new GUPostalCode(postalCode); + case "GW" : + return new GWPostalCode(postalCode); + case "HM" : + return new HMPostalCode(postalCode); case "HN" : return new HNPostalCode(postalCode); case "HR" : return new HRPostalCode(postalCode); + case "HT" : + return new HTPostalCode(postalCode); + case "HU" : + return new HUPostalCode(postalCode); case "ID" : return new IDPostalCode(postalCode); + case "IL" : + return new ILPostalCode(postalCode); + case "IN" : + return new INPostalCode(postalCode); case "IQ" : return new IQPostalCode(postalCode); + case "IS" : + return new ISPostalCode(postalCode); case "IT" : return new ITPostalCode(postalCode); case "JO" : return new JOPostalCode(postalCode); + case "JP" : + return new JPPostalCode(postalCode); case "KE" : return new KEPostalCode(postalCode); + case "KG" : + return new KGPostalCode(postalCode); case "KH" : return new KHPostalCode(postalCode); case "KW" : return new KWPostalCode(postalCode); + case "KZ" : + return new KZPostalCode(postalCode); case "LA" : return new LAPostalCode(postalCode); + case "LI" : + return new LIPostalCode(postalCode); case "LK" : return new LKPostalCode(postalCode); + case "LR" : + return new LRPostalCode(postalCode); + case "LS" : + return new LSPostalCode(postalCode); + case "LU" : + return new LUPostalCode(postalCode); case "LY" : return new LYPostalCode(postalCode); case "MA" : @@ -194,8 +186,12 @@ public PostalCode CreatePostalCode(Country country, string postalCode) return new MCPostalCode(postalCode); case "ME" : return new MEPostalCode(postalCode); + case "MG" : + return new MGPostalCode(postalCode); case "MH" : return new MHPostalCode(postalCode); + case "MK" : + return new MKPostalCode(postalCode); case "MM" : return new MMPostalCode(postalCode); case "MN" : @@ -204,32 +200,74 @@ public PostalCode CreatePostalCode(Country country, string postalCode) return new MPPostalCode(postalCode); case "MQ" : return new MQPostalCode(postalCode); + case "MT" : + return new MTPostalCode(postalCode); case "MU" : return new MUPostalCode(postalCode); case "MX" : return new MXPostalCode(postalCode); case "MY" : return new MYPostalCode(postalCode); + case "MZ" : + return new MZPostalCode(postalCode); case "NA" : return new NAPostalCode(postalCode); + case "NE" : + return new NEPostalCode(postalCode); + case "NF" : + return new NFPostalCode(postalCode); + case "NG" : + return new NGPostalCode(postalCode); case "NI" : return new NIPostalCode(postalCode); + case "NL" : + return new NLPostalCode(postalCode); + case "NO" : + return new NOPostalCode(postalCode); case "NP" : return new NPPostalCode(postalCode); + case "NZ" : + return new NZPostalCode(postalCode); + case "OM" : + return new OMPostalCode(postalCode); + case "PA" : + return new PAPostalCode(postalCode); case "PE" : return new PEPostalCode(postalCode); + case "PG" : + return new PGPostalCode(postalCode); + case "PH" : + return new PHPostalCode(postalCode); case "PK" : return new PKPostalCode(postalCode); + case "PL" : + return new PLPostalCode(postalCode); case "PR" : return new PRPostalCode(postalCode); + case "PS" : + return new PSPostalCode(postalCode); + case "PT" : + return new PTPostalCode(postalCode); case "PW" : return new PWPostalCode(postalCode); + case "PY" : + return new PYPostalCode(postalCode); + case "RO" : + return new ROPostalCode(postalCode); case "RS" : return new RSPostalCode(postalCode); + case "RU" : + return new RUPostalCode(postalCode); case "SD" : return new SDPostalCode(postalCode); case "SE" : return new SEPostalCode(postalCode); + case "SG" : + return new SGPostalCode(postalCode); + case "SI" : + return new SIPostalCode(postalCode); + case "SJ" : + return new SJPostalCode(postalCode); case "SK" : return new SKPostalCode(postalCode); case "SN" : @@ -238,72 +276,34 @@ public PostalCode CreatePostalCode(Country country, string postalCode) return new TDPostalCode(postalCode); case "TH" : return new THPostalCode(postalCode); + case "TJ" : + return new TJPostalCode(postalCode); + case "TM" : + return new TMPostalCode(postalCode); + case "TN" : + return new TNPostalCode(postalCode); case "TR" : return new TRPostalCode(postalCode); + case "TT" : + return new TTPostalCode(postalCode); case "TW" : return new TWPostalCode(postalCode); case "UA" : return new UAPostalCode(postalCode); + case "US" : + return new USPostalCode(postalCode); case "UY" : return new UYPostalCode(postalCode); case "VI" : return new VIPostalCode(postalCode); + case "VN" : + return new VNPostalCode(postalCode); case "YT" : return new YTPostalCode(postalCode); + case "ZA" : + return new ZAPostalCode(postalCode); case "ZM" : return new ZMPostalCode(postalCode); - case "BY" : - return new BYPostalCode(postalCode); - case "CN" : - return new CNPostalCode(postalCode); - case "CO" : - return new COPostalCode(postalCode); - case "EC" : - return new ECPostalCode(postalCode); - case "IN" : - return new INPostalCode(postalCode); - case "KG" : - return new KGPostalCode(postalCode); - case "KZ" : - return new KZPostalCode(postalCode); - case "NG" : - return new NGPostalCode(postalCode); - case "PA" : - return new PAPostalCode(postalCode); - case "RO" : - return new ROPostalCode(postalCode); - case "SG" : - return new SGPostalCode(postalCode); - case "TJ" : - return new TJPostalCode(postalCode); - case "TM" : - return new TMPostalCode(postalCode); - case "TT" : - return new TTPostalCode(postalCode); - case "VN" : - return new VNPostalCode(postalCode); - case "IL" : - return new ILPostalCode(postalCode); - case "JP" : - return new JPPostalCode(postalCode); - case "BB" : - return new BBPostalCode(postalCode); - case "CA" : - return new CAPostalCode(postalCode); - case "GB" : - return new GBPostalCode(postalCode); - case "MT" : - return new MTPostalCode(postalCode); - case "NL" : - return new NLPostalCode(postalCode); - case "PL" : - return new PLPostalCode(postalCode); - case "PT" : - return new PTPostalCode(postalCode); - case "RU" : - return new RUPostalCode(postalCode); - case "US" : - return new USPostalCode(postalCode); } // Default behavior so far was to just return NumericPostalCode diff --git a/src/PostalCodes/Generated/PostalCodeFactory.gen.tt b/src/PostalCodes/Generated/PostalCodeFactory.gen.tt index 8d0135a..c883473 100644 --- a/src/PostalCodes/Generated/PostalCodeFactory.gen.tt +++ b/src/PostalCodes/Generated/PostalCodeFactory.gen.tt @@ -1,15 +1,16 @@ <#@ template language="C#" hostspecific="true" #> +<#@ output extension=".cs" #> <#@ assembly name="System" #> <#@ assembly name="System.Core" #> -<#@ assembly name="System.Web.Extensions" #> +<#@ assembly name="System.Text.Json" #> <#@ import namespace="System.IO" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ import namespace="System.Text.RegularExpressions" #> -<#@ import namespace="System.Web.Script.Serialization" #> +<#@ import namespace="System.Text.Json" #> <# - var filesForCountries = new Dictionary { + var filesForCountries = new Dictionary { { "3Digits.json", new [] { "FO", "IS", "LS", "MG", "OM", "PG", "PS" }}, { "4Digits.json", new [] { "AF", "AL", "AM", "AR", "AT", "AU", "BD", "BE", "BE", "BG", "BO", "CC", "CH", "CV", "CX", "CY", "CY", "DK", "ET", "GE", "GL", "GW", "HM", "HT", "HU", "HU", "LI", "LR", "LU", "MK", "MZ", "NE", "NF", "NO", "NO", "NZ", "PH", "PY", "SI", "SJ", "TN", "ZA" }}, { "5Digits.json", new [] { "AS", "BA", "BT", "CR", "CU", "CZ", "DE", "DO", "DZ", "EE", "EG", "ES", "FI", "FM", "FR", "GR", "GT", "GU", "HN", "HR", "HR", "ID", "IQ", "IT", "JO", "KE", "KH", "KW", "LA", "LK", "LY", "MA", "MC", "ME", "MH", "MM", "MN", "MP", "MQ", "MU", "MX", "MY", "NA", "NI", "NP", "PE", "PK", "PR", "PW", "RS", "SD", "SE", "SK", "SN", "TD", "TH", "TR", "TW", "UA", "UY", "VI", "YT", "ZM" }}, @@ -17,36 +18,37 @@ { "7Digits.json", new [] { "IL", "JP" }} }; - var js = new System.Web.Script.Serialization.JavaScriptSerializer (); + var jsonOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; var countryList = new HashSet(); string templateDirectory = Path.GetDirectoryName(Host.TemplateFile); - foreach(var fileType in filesForCountries) - { - foreach(var countryCode in fileType.Value) - { - var ci = js.Deserialize(File.ReadAllText(Path.Combine(templateDirectory, "../../countries", fileType.Key))); - ci.CountryCodeAlpha2 = countryCode; - ci.CountryName = countryCode; - countryList.Add( ci ); - } - } var jsonFiles = Directory.GetFiles(Path.Combine(templateDirectory, "../../countries/")).Where(a => a.EndsWith(".json")); var regex = new Regex(@"^([A-Z]{2})\.json$"); foreach (var jsonFile in jsonFiles) { - + var match = regex.Match(Path.GetFileName(jsonFile)); if (match.Success) { - var ci = js.Deserialize(File.ReadAllText(jsonFile)); + var ci = JsonSerializer.Deserialize(File.ReadAllText(jsonFile), jsonOptions); countryList.Add( ci ); - } - } + } + } + + foreach(var fileType in filesForCountries) + { + foreach(var countryCode in fileType.Value) + { + var ci = JsonSerializer.Deserialize(File.ReadAllText(Path.Combine(templateDirectory, "../../countries", fileType.Key)), jsonOptions); + ci.CountryCodeAlpha2 = countryCode; + ci.CountryName = countryCode; + countryList.Add( ci ); + } + } var countrySortedList = countryList.OrderBy(a => a.CountryCodeAlpha2).ToList(); - foreach(var countryInfo in countryList) + foreach(var countryInfo in countrySortedList) { GeneratePostalCodeFile(countryInfo); SaveOutput(countryInfo.CountryCodeAlpha2 + "PostalCode.gen.cs"); @@ -96,7 +98,7 @@ namespace PostalCodes switch(country.Code) { <# - foreach(var countryInfo in countryList) + foreach(var countryInfo in countrySortedList) { #> case "<#= countryInfo.CountryCodeAlpha2 #>" : diff --git a/src/PostalCodes/PostalCodes.csproj b/src/PostalCodes/PostalCodes.csproj index a2d45e7..358672a 100644 --- a/src/PostalCodes/PostalCodes.csproj +++ b/src/PostalCodes/PostalCodes.csproj @@ -1,16 +1,7 @@  - netstandard2.0;netcoreapp3.1;net6.0;net8.0 + netstandard2.0;netcoreapp3.1;net6.0;net8.0;net9.0;net10.0 - - - TextTemplatingFileGenerator - PostalCodeFactory.gen.cs - - - - - PostalCodes diff --git a/src/countries/AT.json b/src/countries/AT.json new file mode 100644 index 0000000..1f40287 --- /dev/null +++ b/src/countries/AT.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "AT", + "CountryCodeAlpha2" : "AT", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^A{0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/AU.json b/src/countries/AU.json new file mode 100644 index 0000000..167697c --- /dev/null +++ b/src/countries/AU.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "AU", + "CountryCodeAlpha2" : "AU", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^(ACT|NSW|NT|QLD|SA|TAS|VIC|WA){0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/BE.json b/src/countries/BE.json new file mode 100644 index 0000000..ce5709c --- /dev/null +++ b/src/countries/BE.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "BE", + "CountryCodeAlpha2" : "BE", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^B{0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/DK.json b/src/countries/DK.json new file mode 100644 index 0000000..2111f32 --- /dev/null +++ b/src/countries/DK.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "DK", + "CountryCodeAlpha2" : "DK", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^(DK){0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/FI.json b/src/countries/FI.json new file mode 100644 index 0000000..c915678 --- /dev/null +++ b/src/countries/FI.json @@ -0,0 +1,38 @@ +{ + "CountryName" : "FI", + "CountryCodeAlpha2" : "FI", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "5-Digits - 99999", + "RegexDefault" : "^(FI){0,1}[0-9]{5}$", + "OutputDefault" : "xxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "99999" ], + "Min" : [ "00000" ], + "Valid" : ["12234", "52678"], + "Invalid" : [ "122345", "1223s", "x12u3" ], + "Predecessor" : { + "11234" : "11233", + "82888" : "82887", + "00001" : "00000" + }, + "Successor" : { + "14234" : "14235", + "44852" : "44853", + "99998" : "99999" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/FR.json b/src/countries/FR.json new file mode 100644 index 0000000..3e94cba --- /dev/null +++ b/src/countries/FR.json @@ -0,0 +1,47 @@ +{ + "CountryName" : "FR", + "CountryCodeAlpha2" : "FR", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "5-Digits - 99999", + "RegexDefault" : "^(FR|F|MC){0,1}[0-9]{5}$", + "OutputDefault" : "xxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "99999" ], + "Min" : [ "00000" ], + "Valid" : ["12234", "52678"], + "Invalid" : [ "122345", "1223s", "x12u3" ], + "Predecessor" : { + "11234" : "11233", + "82888" : "82887", + "00001" : "00000" + }, + "Successor" : { + "14234" : "14235", + "44852" : "44853", + "99998" : "99999", + "FR-44852" : "FR-44853", + "F-44852" : "F-44853", + "MC-44852" : "MC-44853", + "FR44852" : "FR44853", + "F44852" : "F44853", + "MC44852" : "MC44853", + "FR 44852" : "FR 44853", + "F 44852" : "F 44853", + "MC 44852" : "MC 44853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/GE.json b/src/countries/GE.json new file mode 100644 index 0000000..2643f39 --- /dev/null +++ b/src/countries/GE.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "GE", + "CountryCodeAlpha2" : "GE", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^(DE){0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/GL.json b/src/countries/GL.json new file mode 100644 index 0000000..9e0a200 --- /dev/null +++ b/src/countries/GL.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "GL", + "CountryCodeAlpha2" : "GL", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^(DK){0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/HR.json b/src/countries/HR.json new file mode 100644 index 0000000..4c6c305 --- /dev/null +++ b/src/countries/HR.json @@ -0,0 +1,38 @@ +{ + "CountryName" : "HR", + "CountryCodeAlpha2" : "HR", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "5-Digits - 99999", + "RegexDefault" : "^(HR){0,1}[0-9]{5}$", + "OutputDefault" : "xxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "99999" ], + "Min" : [ "00000" ], + "Valid" : ["12234", "52678"], + "Invalid" : [ "122345", "1223s", "x12u3" ], + "Predecessor" : { + "11234" : "11233", + "82888" : "82887", + "00001" : "00000" + }, + "Successor" : { + "14234" : "14235", + "44852" : "44853", + "99998" : "99999" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/IL.json b/src/countries/IL.json new file mode 100644 index 0000000..0734546 --- /dev/null +++ b/src/countries/IL.json @@ -0,0 +1,38 @@ +{ + "CountryName" : "IL", + "CountryCodeAlpha2" : "IL", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "7-Digits - 9999999", + "RegexDefault" : "^(ISL){0,1}[0-9]{7}$", + "OutputDefault" : "xxxxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999999" ], + "Min" : [ "0000000" ], + "Valid" : ["1122334", "2525678"], + "Invalid" : [ "12233344235", "d1s223s", "x12d3" ], + "Predecessor" : { + "1126394" : "1126393", + "8286898" : "8286897", + "0000001" : "0000000" + }, + "Successor" : { + "1427934" : "1427935", + "4487952" : "4487953", + "9999998" : "9999999" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/IS.json b/src/countries/IS.json new file mode 100644 index 0000000..f82b6d7 --- /dev/null +++ b/src/countries/IS.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "IS", + "CountryCodeAlpha2" : "IS", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 999", + "RegexDefault" : "^(IS){0,1}[0-9]{3}$", + "OutputDefault" : "xxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "999" ], + "Min" : [ "000" ], + "Valid" : ["123", "567"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "124" : "123", + "888" : "887" + }, + "Successor" : { + "123" : "124", + "485" : "486" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/IT.json b/src/countries/IT.json new file mode 100644 index 0000000..6cc442c --- /dev/null +++ b/src/countries/IT.json @@ -0,0 +1,38 @@ +{ + "CountryName" : "IT", + "CountryCodeAlpha2" : "IT", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "5-Digits - 99999", + "RegexDefault" : "^(I|IT){0,1}[0-9]{5}$", + "OutputDefault" : "xxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "99999" ], + "Min" : [ "00000" ], + "Valid" : ["12234", "52678"], + "Invalid" : [ "122345", "1223s", "x12u3" ], + "Predecessor" : { + "11234" : "11233", + "82888" : "82887", + "00001" : "00000" + }, + "Successor" : { + "14234" : "14235", + "44852" : "44853", + "99998" : "99999" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/LA.json b/src/countries/LA.json new file mode 100644 index 0000000..07f6b78 --- /dev/null +++ b/src/countries/LA.json @@ -0,0 +1,38 @@ +{ + "CountryName" : "LA", + "CountryCodeAlpha2" : "LA", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "5-Digits - 99999", + "RegexDefault" : "^(LV){0,1}[0-9]{5}$", + "OutputDefault" : "xxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "99999" ], + "Min" : [ "00000" ], + "Valid" : ["12234", "52678"], + "Invalid" : [ "122345", "1223s", "x12u3" ], + "Predecessor" : { + "11234" : "11233", + "82888" : "82887", + "00001" : "00000" + }, + "Successor" : { + "14234" : "14235", + "44852" : "44853", + "99998" : "99999" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/LU.json b/src/countries/LU.json new file mode 100644 index 0000000..7842b5e --- /dev/null +++ b/src/countries/LU.json @@ -0,0 +1,39 @@ +{ + "CountryName" : "LU", + "CountryCodeAlpha2" : "LU", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^L{0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853", + "L4852" : "L4853", + "L 4852" : "L 4853", + "L-4852" : "L-4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/NO.json b/src/countries/NO.json new file mode 100644 index 0000000..116f87d --- /dev/null +++ b/src/countries/NO.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "NO", + "CountryCodeAlpha2" : "NO", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^(N|NO){0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/SE.json b/src/countries/SE.json new file mode 100644 index 0000000..54cb8ad --- /dev/null +++ b/src/countries/SE.json @@ -0,0 +1,38 @@ +{ + "CountryName" : "SE", + "CountryCodeAlpha2" : "SE", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "5-Digits - 99999", + "RegexDefault" : "^(SE){0,1}[0-9]{5}$", + "OutputDefault" : "xxxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "99999" ], + "Min" : [ "00000" ], + "Valid" : ["12234", "52678"], + "Invalid" : [ "122345", "1223s", "x12u3" ], + "Predecessor" : { + "11234" : "11233", + "82888" : "82887", + "00001" : "00000" + }, + "Successor" : { + "14234" : "14235", + "44852" : "44853", + "99998" : "99999" + }, + "IsBefore" : {} + } +} diff --git a/src/countries/SI.json b/src/countries/SI.json new file mode 100644 index 0000000..1363e2c --- /dev/null +++ b/src/countries/SI.json @@ -0,0 +1,36 @@ +{ + "CountryName" : "SI", + "CountryCodeAlpha2" : "SI", + + "RedundantCharacters" : " -", + + "Formats" : [ + { + "Name" : "4-Digits - 9999", + "RegexDefault" : "^(SI){0,1}[0-9]{4}$", + "OutputDefault" : "xxxx", + + "LeftPaddingCharacter" : "0", + + "AutoConvertToShort" : "false", + "ShortExpansionAsLowestInRange" : "0", + "ShortExpansionAsHighestInRange" : "9" + } + ], + + "TestData" : { + "Max" : [ "9999" ], + "Min" : [ "0000" ], + "Valid" : ["1234", "5678"], + "Invalid" : [ "12345", "123s", "12x3" ], + "Predecessor" : { + "1234" : "1233", + "8888" : "8887" + }, + "Successor" : { + "1234" : "1235", + "4852" : "4853" + }, + "IsBefore" : {} + } +}