diff --git a/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs index 4df6a1caf..69e58d247 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs @@ -46,7 +46,20 @@ public class NumberToWordsTests [InlineData(415618, "vierhonderdvijftienduizend zeshonderdachttien")] [InlineData(16415618, "zestien miljoen vierhonderdvijftienduizend zeshonderdachttien")] [InlineData(322, "driehonderdtweeëntwintig")] - public void ToWords(int number, string expected) + public void IntToWords(int number, string expected) + { + Assert.Equal(expected, number.ToWords()); + } + + [Theory] + [InlineData(100_000_000_000L, "honderd miljard")] + [InlineData(1_000_000_000_000L, "een biljoen")] + [InlineData(100_000_000_000_000L, "honderd biljoen")] + [InlineData(1_000_000_000_000_000L, "een biljard")] + [InlineData(100_000_000_000_000_000L, "honderd biljard")] + [InlineData(1_000_000_000_000_000_000L, "een triljoen")] + [InlineData(9_223_372_036_854_775_807L, "negen triljoen tweehonderddrieëntwintig biljard driehonderdtweeënzeventig biljoen zesendertig miljard achthonderdvierenvijftig miljoen zevenhonderdvijfenzeventigduizend achthonderdzeven")] + public void LongToWords(long number, string expected) { Assert.Equal(expected, number.ToWords()); } diff --git a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs index 75b89f828..67b3a15df 100644 --- a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs @@ -17,7 +17,7 @@ internal class DutchNumberToWordsConverter : GenderlessNumberToWordsConverter private class Fact { - public int Value { get; set; } + public long Value { get; set; } public string Name { get; set; } public string Prefix { get; set; } public string Postfix { get; set; } @@ -26,19 +26,18 @@ private class Fact private static readonly Fact[] Hunderds = { - new Fact {Value = 1000000000, Name = "miljard", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, - new Fact {Value = 1000000, Name = "miljoen", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, - new Fact {Value = 1000, Name = "duizend", Prefix = "", Postfix = " ", DisplayOneUnit = false}, - new Fact {Value = 100, Name = "honderd", Prefix = "", Postfix = "", DisplayOneUnit = false} + new Fact {Value = 1_000_000_000_000_000_000L, Name = "triljoen", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, + new Fact {Value = 1_000_000_000_000_000L, Name = "biljard", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, + new Fact {Value = 1_000_000_000_000L, Name = "biljoen", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, + new Fact {Value = 1000000000, Name = "miljard", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, + new Fact {Value = 1000000, Name = "miljoen", Prefix = " ", Postfix = " ", DisplayOneUnit = true}, + new Fact {Value = 1000, Name = "duizend", Prefix = "", Postfix = " ", DisplayOneUnit = false}, + new Fact {Value = 100, Name = "honderd", Prefix = "", Postfix = "", DisplayOneUnit = false} }; public override string Convert(long input) { - if (input > Int32.MaxValue || input < Int32.MinValue) - { - throw new NotImplementedException(); - } - var number = (int)input; + var number = input; if (number == 0) { @@ -133,4 +132,4 @@ public override string ConvertToOrdinal(int number) return word + "de"; } } -} \ No newline at end of file +}