This repository has been archived by the owner on Aug 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Adds Portuguese #18
Merged
Merged
Adds Portuguese #18
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
066c94a
Adds Portuguese files.
tgnm cc33d9d
Fixes typo in test name.
tgnm 3414e4e
TryParsePortuguese now passes all tests.
tgnm d614b82
Implemented more tests.
tgnm f904ef8
Tests now pass. Yay
tgnm 1b3544f
All Portuguese tests pass now. yay again
tgnm ea07378
Fixes incorrect spaces.
tgnm 4757228
Merges upstream/master into master.
tgnm 9257893
Adds support for object oriented languages.
tgnm 5adbc2e
Adds more tests for Portuguese.
tgnm f0fd719
Adds Portuguese numeral tests.
tgnm 670260c
Merge upstream/master into add-portuguese
tgnm d486044
Fixes silly merge leftover.
tgnm 4a83569
Portuguese implementation now matches the expected separators between…
tgnm 3b2c54e
Merged master into add-portuguese.
tgnm 65f2a41
Fixes incorrect indentation in test.
tgnm fe0a03e
Adds comment to test and removes unnecessary whitespace.
tgnm c23bfb8
Cleans up reference in project file and incorrect indentation in test.
tgnm 0e0a3ee
Merged master into add-portuguese
tgnm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,4 +97,4 @@ | |
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
module Ploeh.Numsense.PortugueseExamples | ||
|
||
open Xunit | ||
open Swensen.Unquote | ||
|
||
[<Theory>] | ||
[<InlineData( "menos mil, quinhentos e sessenta e oito", -1568)>] | ||
[<InlineData( "menos um", -1)>] | ||
[<InlineData( "zero", 0)>] | ||
[<InlineData( " zero", 0)>] | ||
[<InlineData( "zero ", 0)>] | ||
[<InlineData( " zero ", 0)>] | ||
[<InlineData( "Zero", 0)>] | ||
[<InlineData( "ZERO", 0)>] | ||
[<InlineData( " zERo\t", 0)>] | ||
[<InlineData( "um", 1)>] | ||
[<InlineData( "UM", 1)>] | ||
[<InlineData( "dois", 2)>] | ||
[<InlineData( " dois", 2)>] | ||
[<InlineData( "três", 3)>] | ||
[<InlineData( "três ", 3)>] | ||
[<InlineData( "quatro", 4)>] | ||
[<InlineData( " quatro ", 4)>] | ||
[<InlineData( "cinco", 5)>] | ||
[<InlineData( "CiNcO", 5)>] | ||
[<InlineData( "seis", 6)>] | ||
[<InlineData( " seis ", 6)>] | ||
[<InlineData( "sete", 7)>] | ||
[<InlineData( " seTe", 7)>] | ||
[<InlineData( "oito", 8)>] | ||
[<InlineData( "oITO", 8)>] | ||
[<InlineData( "nove", 9)>] | ||
[<InlineData( "nOvE ", 9)>] | ||
[<InlineData( "dez", 10)>] | ||
[<InlineData( "onze", 11)>] | ||
[<InlineData( "doze", 12)>] | ||
[<InlineData( "treze", 13)>] | ||
[<InlineData( "quatorze", 14)>] | ||
[<InlineData( "catorze", 14)>] | ||
[<InlineData( "quinze", 15)>] | ||
[<InlineData( "dezasseis", 16)>] | ||
[<InlineData( "dezassete", 17)>] | ||
[<InlineData( "dezoito", 18)>] | ||
[<InlineData( "dezanove", 19)>] | ||
[<InlineData( "vinte", 20)>] | ||
[<InlineData( "vinteeum", 21)>] | ||
[<InlineData( "vinte e um", 21)>] | ||
[<InlineData( "trinta", 30)>] | ||
[<InlineData( "trintaequatro", 34)>] | ||
[<InlineData( "trinta-e oito", 38)>] | ||
[<InlineData( "quarenta", 40)>] | ||
[<InlineData( "quarenta e-um", 41)>] | ||
[<InlineData( "quarenta e quatro", 44)>] | ||
[<InlineData( "cinquenta", 50)>] | ||
[<InlineData( "cinquentaesete", 57)>] | ||
[<InlineData( "sessenta", 60)>] | ||
[<InlineData( "sessentaecinco", 65)>] | ||
[<InlineData( "setenta", 70)>] | ||
[<InlineData( "setenta e sete", 77)>] | ||
[<InlineData( "setentaenove", 79)>] | ||
[<InlineData( "oitenta", 80)>] | ||
[<InlineData( "oitentaeseis", 86)>] | ||
[<InlineData( "noventa", 90)>] | ||
[<InlineData( "noventaetrês", 93)>] | ||
[<InlineData( "cem", 100)>] | ||
[<InlineData( "centoeum", 101)>] | ||
[<InlineData( "cento e um", 101)>] | ||
[<InlineData( "duzentos", 200)>] | ||
[<InlineData( "duzentosetrintaesete", 237)>] | ||
[<InlineData( "trezentosesetentaecinco", 375)>] | ||
[<InlineData( "quatrocentosenoventa", 490)>] | ||
[<InlineData( "quinhentosesessentaetrês", 563)>] | ||
[<InlineData( "seiscentosedezoito", 618)>] | ||
[<InlineData( "setecentosesetentaesete", 777)>] | ||
[<InlineData( "oitocentosecinco", 805)>] | ||
[<InlineData( "oitocentoseseis", 806)>] | ||
[<InlineData( "novecentosecinquentaenove", 959)>] | ||
[<InlineData( "mil", 1000)>] | ||
[<InlineData( "mileum", 1001)>] | ||
[<InlineData( "miledois", 1002)>] | ||
[<InlineData( "milesessentaequatro", 1064)>] | ||
[<InlineData( "doismil", 2000)>] | ||
[<InlineData( "oitomilsetecentosevinteeum", 8721)>] | ||
[<InlineData( "novemilcentoevinteetrês", 9123)>] | ||
[<InlineData( "dezmil", 10000)>] | ||
[<InlineData( "dezmilcentoeum", 10101)>] | ||
[<InlineData( "dezmilcentoedois", 10102)>] | ||
[<InlineData( "vinteetrêsmilquinhentosesessentaequatro", 23564)>] | ||
[<InlineData( "oitentamiledez", 80010)>] | ||
[<InlineData( "cemmil", 100000)>] | ||
[<InlineData( "cemmileum", 100001)>] | ||
[<InlineData( "trezentosedezanovemiltrezentosequarentaenove", 319349)>] | ||
[<InlineData( "ummilhão", 1000000)>] | ||
[<InlineData( "ummilhãoeum", 1000001)>] | ||
[<InlineData( "doismilhõesedez", 2000010)>] | ||
[<InlineData( "seismilhõesetrintamil", 6030000)>] | ||
[<InlineData( "novemilhõesduzentoseummilseiscentoseoitenta", 9201680)>] | ||
[<InlineData( "dezmilhões", 10000000)>] | ||
[<InlineData( "dezmilhõesenove", 10000009)>] | ||
[<InlineData( "vinteeummilhões", 21000000)>] | ||
[<InlineData( | ||
"quarentaesetemilhõesseiscentosesessentaeummilesessenta", 47661060)>] | ||
[<InlineData( "cemmilhões", 100000000)>] | ||
[<InlineData( "duzentosecincomilhões", 205000000)>] | ||
[<InlineData( "trezentos e sete milhões", 307000000)>] | ||
[<InlineData( | ||
"quatrocentosesessentaeummilhõessessentamileseiscentos", 461060600)>] | ||
[<InlineData( "milmilhões", 1000000000)>] | ||
[<InlineData( "doismilmilhões", 2000000000)>] | ||
[<InlineData( | ||
"doismilequarentaenovemilhõesseiscentosecinquentamil", 2049650000)>] | ||
[<InlineData( | ||
"doismilcentoequarentaesetemilhõesquatrocentoseoitentaetrêsmilseiscentosequarentaesete", | ||
System.Int32.MaxValue)>] | ||
let ``tryParsePortuguese returns correct result`` (portuguese, expected) = | ||
let actual = Numeral.tryParsePortuguese portuguese | ||
Some expected =! actual | ||
|
||
[<Theory>] | ||
[<InlineData( -1586, "menos mil, quinhentos e oitenta e seis")>] | ||
[<InlineData( -1, "menos um")>] | ||
[<InlineData( 0, "zero")>] | ||
[<InlineData( 1, "um")>] | ||
[<InlineData( 2, "dois")>] | ||
[<InlineData( 3, "três")>] | ||
[<InlineData( 4, "quatro")>] | ||
[<InlineData( 5, "cinco")>] | ||
[<InlineData( 6, "seis")>] | ||
[<InlineData( 7, "sete")>] | ||
[<InlineData( 8, "oito")>] | ||
[<InlineData( 9, "nove")>] | ||
[<InlineData( 10, "dez")>] | ||
[<InlineData( 11, "onze")>] | ||
[<InlineData( 12, "doze")>] | ||
[<InlineData( 13, "treze")>] | ||
[<InlineData( 14, "catorze")>] | ||
[<InlineData( 15, "quinze")>] | ||
[<InlineData( 16, "dezasseis")>] | ||
[<InlineData( 17, "dezassete")>] | ||
[<InlineData( 18, "dezoito")>] | ||
[<InlineData( 19, "dezanove")>] | ||
[<InlineData( 20, "vinte")>] | ||
[<InlineData( 21, "vinte e um")>] | ||
[<InlineData( 30, "trinta")>] | ||
[<InlineData( 34, "trinta e quatro")>] | ||
[<InlineData( 40, "quarenta")>] | ||
[<InlineData( 42, "quarenta e dois")>] | ||
[<InlineData( 50, "cinquenta")>] | ||
[<InlineData( 58, "cinquenta e oito")>] | ||
[<InlineData( 60, "sessenta")>] | ||
[<InlineData( 65, "sessenta e cinco")>] | ||
[<InlineData( 70, "setenta")>] | ||
[<InlineData( 79, "setenta e nove")>] | ||
[<InlineData( 80, "oitenta")>] | ||
[<InlineData( 86, "oitenta e seis")>] | ||
[<InlineData( 90, "noventa")>] | ||
[<InlineData( 93, "noventa e três")>] | ||
[<InlineData( 100, "cem")>] | ||
[<InlineData( 101, "cento e um")>] | ||
[<InlineData( 110, "cento e dez")>] | ||
[<InlineData( 114, "cento e catorze")>] | ||
[<InlineData( 135, "cento e trinta e cinco")>] | ||
[<InlineData( 200, "duzentos")>] | ||
[<InlineData( 282, "duzentos e oitenta e dois")>] | ||
[<InlineData( 331, "trezentos e trinta e um")>] | ||
[<InlineData( 407, "quatrocentos e sete")>] | ||
[<InlineData( 520, "quinhentos e vinte")>] | ||
[<InlineData( 666, "seiscentos e sessenta e seis")>] | ||
[<InlineData( 798, "setecentos e noventa e oito")>] | ||
[<InlineData( 857, "oitocentos e cinquenta e sete")>] | ||
[<InlineData( 999, "novecentos e noventa e nove")>] | ||
[<InlineData( 1000, "mil")>] | ||
[<InlineData( 1001, "mil e um")>] | ||
[<InlineData( 1010, "mil e dez")>] | ||
[<InlineData( 1066, "mil e sessenta e seis")>] | ||
[<InlineData( 1337, "mil, trezentos e trinta e sete")>] | ||
[<InlineData( 1984, "mil, novecentos e oitenta e quatro")>] | ||
[<InlineData( 7441, "sete mil, quatrocentos e quarenta e um")>] | ||
[<InlineData( 8513, "oito mil, quinhentos e treze")>] | ||
[<InlineData( 908077, "novecentos e oito mil e setenta e sete")>] | ||
[<InlineData( 1000000, "um milhão")>] | ||
[<InlineData( 2000002, "dois milhões e dois")>] | ||
[<InlineData( 3040506, "três milhões e quarenta mil, quinhentos e seis")>] | ||
[<InlineData( 4025800, "quatro milhões e vinte e cinco mil e oitocentos")>] | ||
[<InlineData( 4321000, "quatro milhões, trezentos e vinte e um mil")>] | ||
[<InlineData( 4600819, "quatro milhões e seiscentos mil, oitocentos e dezanove")>] | ||
[<InlineData( 5004621, "cinco milhões e quatro mil, seiscentos e vinte e um")>] | ||
[<InlineData( 6982001, "seis milhões, novecentos e oitenta e dois mil e um")>] | ||
[<InlineData( 7000000, "sete milhões")>] | ||
[<InlineData( 8000220, "oito milhões, duzentos e vinte")>] | ||
[<InlineData( 9099000, "nove milhões e noventa e nove mil")>] | ||
[<InlineData( 10000000, "dez milhões")>] | ||
[<InlineData( 24000000, "vinte e quatro milhões")>] | ||
[<InlineData( 39020011, "trinta e nove milhões e vinte mil e onze")>] | ||
[<InlineData( 40606100, "quarenta milhões, seiscentos e seis mil e cem")>] | ||
[<InlineData( 53000000, "cinquenta e três milhões")>] | ||
[<InlineData( 64000098, "sessenta e quatro milhões e noventa e oito")>] | ||
[<InlineData( 70003190, "setenta milhões e três mil, cento e noventa")>] | ||
[<InlineData( 80000000, "oitenta milhões")>] | ||
[<InlineData( 99000099, "noventa e nove milhões e noventa e nove")>] | ||
[<InlineData( 100000000, "cem milhões")>] | ||
[<InlineData( 209000000, "duzentos e nove milhões")>] | ||
[<InlineData( 398000000, "trezentos e noventa e oito milhões")>] | ||
[<InlineData( 439011000, "quatrocentos e trinta e nove milhões e onze mil")>] | ||
[<InlineData( 560400000, "quinhentos e sessenta milhões e quatrocentos mil")>] | ||
[<InlineData( 600010900, "seiscentos milhões e dez mil e novecentos")>] | ||
[<InlineData( 700000000, "setecentos milhões")>] | ||
[<InlineData( 800116000, "oitocentos milhões, cento e dezasseis mil")>] | ||
[<InlineData( 900800007, "novecentos milhões e oitocentos mil e sete")>] | ||
[<InlineData(1000000000, "mil milhões")>] | ||
[<InlineData(2121000000, "dois mil milhões, cento e vinte e um milhões")>] | ||
[<InlineData( | ||
System.Int32.MaxValue, | ||
"dois mil milhões, cento e quarenta e sete milhões, quatrocentos e oitenta e três mil, seiscentos e quarenta e sete")>] | ||
|
||
let ``toPortuguese returns correct result`` (i, expected) = | ||
let actual = Numeral.toPortuguese i | ||
expected =! actual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonus points for not repeating my mistake of naming the test function
tryOfPortuguese... etc.
👍