Skip to content

Commit

Permalink
Add tests for long.ToWords() and update XML comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pethick authored and Oren Novotny committed May 4, 2017
1 parent e1fce66 commit 06871bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/Humanizer.Tests.Shared/NumberToWordsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ public void ToWords(int number, string expected)
Assert.Equal(expected, number.ToWords());
}

[InlineData(1L, "one")]
[InlineData(11L, "eleven")]
[InlineData(111L, "one hundred and eleven")]
[InlineData(1111L, "one thousand one hundred and eleven")]
[InlineData(11111L, "eleven thousand one hundred and eleven")]
[InlineData(111111L, "one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111L, "one million one hundred and eleven thousand one hundred and eleven")]
[InlineData(11111111L, "eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(111111111L, "one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111111L, "one billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(11111111111L, "eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(111111111111L, "one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111111111L, "one trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(11111111111111L, "eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(111111111111111L, "one hundred and eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111111111111L, "one quadrillion one hundred and eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(11111111111111111L, "eleven quadrillion one hundred and eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(111111111111111111L, "one hundred and eleven quadrillion one hundred and eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111111111111111L, "one quintillion one hundred and eleven quadrillion one hundred and eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(11111111111111111111L, "eleven quintillion one hundred and eleven quadrillion one hundred and eleven trillion one hundred and eleven billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[Theory]
public void ToWords(long number, string expected)
{
Assert.Equal(expected, number.ToWords());
}

[Theory]
[InlineData(0, "zeroth")]
[InlineData(1, "first")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface INumberToWordsConverter
/// <summary>
/// Converts the number to ordinal string using the locale's default grammatical gender
/// </summary>
/// <param name="number>"</param>
/// <param name="number"></param>
/// <returns></returns>
string ConvertToOrdinal(int number);

Expand Down

0 comments on commit 06871bb

Please sign in to comment.