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 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
393 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
module Ploeh.Numsense.NorwegianExamples | ||
|
||
open Xunit | ||
open Swensen.Unquote | ||
|
||
|
||
[<Theory>] | ||
[<InlineData( "null", 0)>] | ||
[<InlineData( " null", 0)>] | ||
[<InlineData( "null ", 0)>] | ||
[<InlineData( " null ", 0)>] | ||
[<InlineData( "Null", 0)>] | ||
[<InlineData( "NULL", 0)>] | ||
[<InlineData( "nUlL\t", 0)>] | ||
[<InlineData( "ett", 1)>] | ||
[<InlineData( "en", 1)>] | ||
[<InlineData( "ETT", 1)>] | ||
[<InlineData( "to", 2)>] | ||
[<InlineData( " to", 2)>] | ||
[<InlineData( "tre", 3)>] | ||
[<InlineData( "tre ", 3)>] | ||
[<InlineData( "fire", 4)>] | ||
[<InlineData( " fire ", 4)>] | ||
[<InlineData( "fem", 5)>] | ||
[<InlineData( "FeM", 5)>] | ||
[<InlineData( "seks", 6)>] | ||
[<InlineData( " SEKS ", 6)>] | ||
[<InlineData( "sju", 7)>] | ||
[<InlineData( " sJu", 7)>] | ||
[<InlineData( "åtte", 8)>] | ||
[<InlineData( "åTTE", 8)>] | ||
[<InlineData( "ni", 9)>] | ||
[<InlineData( "Ni ", 9)>] | ||
[<InlineData( "ti", 10)>] | ||
[<InlineData( "elleve", 11)>] | ||
[<InlineData( "tolv", 12)>] | ||
[<InlineData( "tretten", 13)>] | ||
[<InlineData( "fjorten", 14)>] | ||
[<InlineData( "femten", 15)>] | ||
[<InlineData( "seksten", 16)>] | ||
[<InlineData( "sytten", 17)>] | ||
[<InlineData( "atten", 18)>] | ||
[<InlineData( "nitten", 19)>] | ||
[<InlineData( "tjue", 20)>] | ||
[<InlineData( "tjueen", 21)>] | ||
[<InlineData( "tretti", 30)>] | ||
[<InlineData( "trettifire", 34)>] | ||
[<InlineData( "førti", 40)>] | ||
[<InlineData( "førtifire", 44)>] | ||
[<InlineData( "femti", 50)>] | ||
[<InlineData( "femtisju", 57)>] | ||
[<InlineData( "seksti", 60)>] | ||
[<InlineData( "sekstifem", 65)>] | ||
[<InlineData( "sytti", 70)>] | ||
[<InlineData( "syttini", 79)>] | ||
[<InlineData( "åtti", 80)>] | ||
[<InlineData( "åttiseks", 86)>] | ||
[<InlineData( "nitti", 90)>] | ||
[<InlineData( "nittitre", 93)>] | ||
[<InlineData( "hundre", 100)>] | ||
[<InlineData( "etthundre", 100)>] | ||
[<InlineData( "hundreogen", 101)>] | ||
[<InlineData( "hundreogett", 101)>] | ||
[<InlineData( "hundre-og-ett", 101)>] | ||
[<InlineData( "etthundreogett", 101)>] | ||
//[<InlineData( "etthundreogett", 101)>] | ||
//[<InlineData( "ett-hundre-og-ett", 101)>] | ||
//[<InlineData( "tohundre", 200)>] | ||
//[<InlineData( "tohundreoftrettisju", 237)>] | ||
//[<InlineData( "trehundreogsyttifem", 375)>] | ||
//[<InlineData( "firehundreognitti", 490)>] | ||
//[<InlineData( "femhundreogsekstitre", 563)>] | ||
//[<InlineData( "sekshundreogatten", 618)>] | ||
//[<InlineData( "sjuhundreogsyttisju", 777)>] | ||
//[<InlineData( "åttehundreogfem", 805)>] | ||
//[<InlineData( "åttehundreogseks", 806)>] | ||
//[<InlineData( "åttehundre-og-sju", 807)>] | ||
//[<InlineData( "nihundreogfemtini", 959)>] | ||
//[<InlineData( "tusen", 1000)>] | ||
//[<InlineData( "ettusen", 1000)>] | ||
//[<InlineData( "tusenogen", 1001)>] | ||
//[<InlineData( "ettusenogto", 1002)>] | ||
//[<InlineData( "ettusenogsekstifire", 1064)>] | ||
//[<InlineData( "totusen", 2000)>] | ||
//[<InlineData( "åttetusensjuhundreogtjueen", 8721)>] | ||
//[<InlineData( "ni-tusen-ett-hundre-og-tjue-tre", 9123)>] | ||
//[<InlineData( "titusen", 10000)>] | ||
//[<InlineData( "titusenetthundredogen", 10101)>] | ||
//[<InlineData( "ti-tusen-ett-hundre-og-to", 10102)>] | ||
//[<InlineData( "tjuetretusenfemhundreogsekstifire", 23564)>] | ||
//[<InlineData( "åttitusenogti", 80010)>] | ||
//[<InlineData( "hundretusen", 100000)>] | ||
//[<InlineData( "etthundretusen", 100000)>] | ||
//[<InlineData( "etthundretusenogen", 100001)>] | ||
//[<InlineData( "trehundreognittentusentrehundreogførtini", 319349)>] | ||
//[<InlineData( "enmillion", 1000000)>] | ||
//[<InlineData( "enmillionen", 1000001)>] | ||
//[<InlineData( "tomillionerogti", 2000010)>] | ||
//[<InlineData( "seksmillionerogtrettitusen", 6030000)>] | ||
//[<InlineData( "nimillionertohundreogettusensekshundreogåtti", 9201680)>] | ||
//[<InlineData( "timillioner", 10000000)>] | ||
//[<InlineData( "timillionerogni", 10000009)>] | ||
//[<InlineData( "tjueen millioner", 21000000)>] | ||
//[<InlineData("førtisjumillionersekshundreogsekstientusenogseksti", 47661060)>] | ||
//[<InlineData( "hundre millioner", 100000000)>] | ||
//[<InlineData( "etthundremillioner", 100000000)>] | ||
//[<InlineData( "tohundreogfemmillioner", 205000000)>] | ||
//[<InlineData( "tre-hundre-og-sju-millioner", 307000000)>] | ||
//[<InlineData("firehundreogsekstienmillionersekstitusentohundre", 461060200)>] | ||
//[<InlineData( "enmilliard", 1000000000)>] | ||
//[<InlineData( "to milliarder", 2000000000)>] | ||
//[<InlineData("tomilliardertjuenimillionertohunderogsekstitusen", 2029260000)>] | ||
//[<InlineData( | ||
// "tomilliarderetthundreogførtisjumillionerfirehundreogåttitretusensekshundreogførtisju", | ||
// System.Int32.MaxValue)>] | ||
let ``tryParseNorwegian returns correct result`` (norwegian, expected) = | ||
let actual = Numeral.tryParseNorwegian norwegian | ||
Some expected =! actual | ||
|
||
|
||
|
||
[<Theory>] | ||
[<InlineData( 0, "null")>] | ||
[<InlineData( 1, "ett")>] | ||
[<InlineData( 2, "to")>] | ||
[<InlineData( 3, "tre")>] | ||
[<InlineData( 4, "fire")>] | ||
[<InlineData( 5, "fem")>] | ||
[<InlineData( 6, "seks")>] | ||
[<InlineData( 7, "sju")>] | ||
[<InlineData( 8, "åtte")>] | ||
[<InlineData( 9, "ni")>] | ||
[<InlineData( 10, "ti")>] | ||
[<InlineData( 11, "elleve")>] | ||
[<InlineData( 12, "tolv")>] | ||
[<InlineData( 13, "tretten")>] | ||
[<InlineData( 14, "fjorten")>] | ||
[<InlineData( 15, "femten")>] | ||
[<InlineData( 16, "seksten")>] | ||
[<InlineData( 17, "sytten")>] | ||
[<InlineData( 18, "atten")>] | ||
[<InlineData( 19, "nitten")>] | ||
[<InlineData( 20, "tjue")>] | ||
[<InlineData( 21, "tjue-en")>] | ||
[<InlineData( 30, "tretti")>] | ||
[<InlineData( 34, "tretti-fire")>] | ||
[<InlineData( 40, "førti")>] | ||
[<InlineData( 42, "førti-to")>] | ||
[<InlineData( 50, "femti")>] | ||
[<InlineData( 58, "femti-åtte")>] | ||
[<InlineData( 60, "seksti")>] | ||
[<InlineData( 65, "seksti-fem")>] | ||
[<InlineData( 70, "sytti")>] | ||
[<InlineData( 79, "sytti-ni")>] | ||
[<InlineData( 80, "åtti")>] | ||
[<InlineData( 86, "åtti-seks")>] | ||
[<InlineData( 90, "nitti")>] | ||
[<InlineData( 93, "nitti-tre")>] | ||
[<InlineData( 100, "ett-hundre")>] | ||
[<InlineData( 101, "ett-hundre-og-en")>] | ||
[<InlineData( 110, "ett-hundre-og-ti")>] | ||
[<InlineData( 114, "ett-hundre-og-fjorten")>] | ||
[<InlineData( 135, "ett-hundre-og-tretti-fem")>] | ||
[<InlineData( 200, "to-hundre")>] | ||
[<InlineData( 282, "to-hundre-og-åtti-to")>] | ||
[<InlineData( 331, "tre-hundre-og-tretti-en")>] | ||
[<InlineData( 407, "fire-hundre-og-sju")>] | ||
[<InlineData( 520, "fem-hundre-og-tjue")>] | ||
[<InlineData( 666, "seks-hundre-og-seksti-seks")>] | ||
[<InlineData( 798, "sju-hundre-og-nitti-åtte")>] | ||
[<InlineData( 857, "åtte-hundre-og-femti-sju")>] | ||
[<InlineData( 999, "ni-hundre-og-nitti-ni")>] | ||
[<InlineData( 1000, "ett-tusen")>] | ||
[<InlineData( 1001, "ett-tusen-og-en")>] | ||
[<InlineData( 1010, "ett-tusen-og-ti")>] | ||
[<InlineData( 1066, "ett-tusen-og-seksti-seks")>] | ||
[<InlineData( 1337, "ett-tusen-tre-hundre-og-tretti-sju")>] | ||
[<InlineData( 1984, "ett-tusen-ni-hundre-og-åtti-fire")>] | ||
[<InlineData( 2015, "to-tusen-og-femten")>] | ||
[<InlineData( 3000, "tre-tusen")>] | ||
[<InlineData( 3297, "tre-tusen-to-hundre-og-nitti-sju")>] | ||
[<InlineData( 4080, "fire-tusen-og-åtti")>] | ||
[<InlineData( 5011, "fem-tusen-og-elleve")>] | ||
[<InlineData( 6025, "seks-tusen-og-tjue-fem")>] | ||
[<InlineData( 7441, "sju-tusen-fire-hundre-og-førti-en")>] | ||
[<InlineData( 8513, "åtte-tusen-fem-hundre-og-tretten")>] | ||
[<InlineData( 9000, "ni-tusen")>] | ||
[<InlineData( 10000, "ti-tusen")>] | ||
[<InlineData( 12001, "tolv-tusen-og-en")>] | ||
[<InlineData( 23846, "tjue-tre-tusen-åtte-hundre-og-førti-seks")>] | ||
[<InlineData( 32109, "tretti-to-tusen-ett-hundre-og-ni")>] | ||
[<InlineData( 40404, "førti-tusen-fire-hundre-og-fire")>] | ||
[<InlineData( 52789, "femti-to-tusen-sju-hundre-og-åtti-ni")>] | ||
[<InlineData( 60015, "seksti-tusen-og-femten")>] | ||
[<InlineData( 71003, "sytti-en-tusen-og-tre")>] | ||
[<InlineData( 80522, "åtti-tusen-fem-hundre-og-tjue-to")>] | ||
[<InlineData( 98962, "nitti-åtte-tusen-ni-hundre-og-seksti-to")>] | ||
[<InlineData( 100000, "ett-hundre-tusen")>] | ||
[<InlineData( 100001, "ett-hundre-tusen-og-en")>] | ||
[<InlineData( 100010, "ett-hundre-tusen-og-ti")>] | ||
[<InlineData( 101010, "ett-hundre-og-en-tusen-og-ti")>] | ||
[<InlineData( 200000, "to-hundre-tusen")>] | ||
[<InlineData( 321000, "tre-hundre-og-tjue-en-tusen")>] | ||
[<InlineData( 412516, "fire-hundre-og-tolv-tusen-fem-hundre-og-seksten")>] | ||
[<InlineData( 560120, "fem-hundre-og-seksti-tusen-ett-hundre-og-tjue")>] | ||
[<InlineData( 600000, "seks-hundre-tusen")>] | ||
[<InlineData( 788000, "sju-hundre-og-åtti-åtte-tusen")>] | ||
[<InlineData( 872900, "åtte-hundre-og-sytti-to-tusen-ni-hundre")>] | ||
[<InlineData( 908077, "ni-hundre-og-åtte-tusen-og-sytti-sju")>] | ||
[<InlineData( 1000000, "en-million")>] | ||
[<InlineData( 2000002, "to-millioner-og-to")>] | ||
[<InlineData( 3040506, "tre-millioner-førti-tusen-fem-hundre-og-seks")>] | ||
[<InlineData( 4321000, "fire-millioner-tre-hundre-og-tjue-en-tusen")>] | ||
[<InlineData( 5003621, "fem-millioner-tre-tusen-seks-hundre-og-tjue-en")>] | ||
[<InlineData( 5982001, "fem-millioner-ni-hundre-og-åtti-to-tusen-og-en")>] | ||
[<InlineData( 6902001, "seks-millioner-ni-hundre-og-to-tusen-og-en")>] | ||
[<InlineData( 7000000, "sju-millioner")>] | ||
[<InlineData( 8000220, "åtte-millioner-to-hundre-og-tjue")>] | ||
[<InlineData( 9099000, "ni-millioner-nitti-ni-tusen")>] | ||
[<InlineData( 10000000, "ti-millioner")>] | ||
[<InlineData( 24000000, "tjue-fire-millioner")>] | ||
[<InlineData( 39020011, "tretti-ni-millioner-tjue-tusen-og-elleve")>] | ||
[<InlineData( 40209100, "førti-millioner-to-hundre-og-ni-tusen-ett-hundre")>] | ||
[<InlineData( 53000000, "femti-tre-millioner")>] | ||
[<InlineData( 64000098, "seksti-fire-millioner-og-nitti-åtte")>] | ||
[<InlineData( 70003180, "sytti-millioner-tre-tusen-ett-hundre-og-åtti")>] | ||
[<InlineData( 80000000, "åtti-millioner")>] | ||
[<InlineData( 99000099, "nitti-ni-millioner-og-nitti-ni")>] | ||
[<InlineData( 100000000, "ett-hundre-millioner")>] | ||
[<InlineData( 209000000, "to-hundre-og-ni-millioner")>] | ||
[<InlineData( 398000000, "tre-hundre-og-nitti-åtte-millioner")>] | ||
[<InlineData( 439012000, "fire-hundre-og-tretti-ni-millioner-tolv-tusen")>] | ||
[<InlineData( 560400000, "fem-hundre-og-seksti-millioner-fire-hundre-tusen")>] | ||
[<InlineData( 600010900, "seks-hundre-millioner-ti-tusen-ni-hundre")>] | ||
[<InlineData( 700000000, "sju-hundre-millioner")>] | ||
[<InlineData( 800115000, "åtte-hundre-millioner-ett-hundre-og-femten-tusen")>] | ||
[<InlineData( 900800007, "ni-hundre-millioner-åtte-hundre-tusen-og-sju")>] | ||
[<InlineData(1000000000, "en-milliard")>] | ||
[<InlineData(1000000080, "en-milliard-og-åtti")>] | ||
[<InlineData(1000000120, "en-milliard-ett-hundre-og-tjue")>] | ||
[<InlineData(2121000000, "to-milliarder-ett-hundre-og-tjue-en-millioner")>] | ||
|
||
let ``toNorwegian returns correct result`` (i, expected) = | ||
let actual = Numeral.toNorwegian 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
Oops, something went wrong.