<commit_before>﻿module Ploeh.Numsense.EnglishExamples

open Xunit
open Swensen.Unquote

[<Theory>]
[<InlineData(                                                "zero",          0)>]
[<InlineData(                                               " zero",          0)>]
[<InlineData(                                               "zero ",          0)>]
[<InlineData(                                            "  zero  ",          0)>]
[<InlineData(                                                "Zero",          0)>]
[<InlineData(                                                "ZERO",          0)>]
[<InlineData(                                             " zERo\t",          0)>]
[<InlineData(                                                 "one",          1)>]
[<InlineData(                                                 "ONE",          1)>]
[<InlineData(                                                 "two",          2)>]
[<InlineData(                                                " two",          2)>]
[<InlineData(                                               "three",          3)>]
[<InlineData(                                             "three  ",          3)>]
[<InlineData(                                                "four",          4)>]
[<InlineData(                                             "  four ",          4)>]
[<InlineData(                                                "five",          5)>]
[<InlineData(                                                "FivE",          5)>]
[<InlineData(                                                 "six",          6)>]
[<InlineData(                                             "  SIX  ",          6)>]
[<InlineData(                                               "seven",          7)>]
[<InlineData(                                           "    seVen",          7)>]
[<InlineData(                                               "eight",          8)>]
[<InlineData(                                               "eIGHT",          8)>]
[<InlineData(                                                "nine",          9)>]
[<InlineData(                                              "NiNe  ",          9)>]
[<InlineData(                                                 "ten",         10)>]
[<InlineData(                                              "eleven",         11)>]
[<InlineData(                                              "twelve",         12)>]
[<InlineData(                                            "thirteen",         13)>]
[<InlineData(                                            "fourteen",         14)>]
[<InlineData(                                             "fifteen",         15)>]
[<InlineData(                                             "sixteen",         16)>]
[<InlineData(                                           "seventeen",         17)>]
[<InlineData(                                            "eighteen",         18)>]
[<InlineData(                                            "nineteen",         19)>]
[<InlineData(                                              "twenty",         20)>]
[<InlineData(                                           "twentyone",         21)>]
[<InlineData(                                              "thirty",         30)>]
[<InlineData(                                          "thirtyfour",         34)>]
[<InlineData(                                               "forty",         40)>]
[<InlineData(                                           "fortyfour",         44)>]
[<InlineData(                                               "fifty",         50)>]
[<InlineData(                                          "fiftyseven",         57)>]
[<InlineData(                                               "sixty",         60)>]
[<InlineData(                                           "sixtyfive",         65)>]
[<InlineData(                                             "seventy",         70)>]
[<InlineData(                                         "seventynine",         79)>]
[<InlineData(                                              "eighty",         80)>]
[<InlineData(                                           "eightysix",         86)>]
[<InlineData(                                              "ninety",         90)>]
[<InlineData(                                         "ninetythree",         93)>]
[<InlineData(                                             "hundred",        100)>]
[<InlineData(                                          "onehundred",        100)>]
[<InlineData(                                          "hundredone",        101)>]
[<InlineData(                                       "onehundredone",        101)>]
[<InlineData(                                          "twohundred",        200)>]
[<InlineData(                               "twohundredthirtyseven",        237)>]
[<InlineData(                             "threehundredseventyfive",        375)>]
[<InlineData(                                   "fourhundredninety",        490)>]
[<InlineData(                               "fivehundredsixtythree",        563)>]
[<InlineData(                                  "sixhundredeighteen",        618)>]
[<InlineData(                            "sevenhundredseventyseven",        777)>]
[<InlineData(                                    "eighthundredfive",        805)>]
[<InlineData(                                "ninehundredfiftynine",        959)>]
[<InlineData(                                            "thousand",       1000)>]
[<InlineData(                                         "onethousand",       1000)>]
[<InlineData(                                         "thousandone",       1001)>]
[<InlineData(                                      "onethousandtwo",       1002)>]
[<InlineData(                                "onethousandsixtyfour",       1064)>]
[<InlineData(                                         "twothousand",       2000)>]
[<InlineData(                  "eightthousandsevenhundredtwentyone",       8721)>]
[<InlineData(                                         "tenthousand",      10000)>]
[<InlineData(                            "tenthousandonehundredone",      10101)>]
[<InlineData(             "twentythreethousandfivehundredsixtyfour",      23564)>]
[<InlineData(                                   "eightythousandten",      80010)>]
[<InlineData(                                     "hundredthousand",     100000)>]
[<InlineData(                                  "onehundredthousand",     100000)>]
[<InlineData(                               "onehundredthousandone",     100001)>]
[<InlineData(   "threehundrednineteenthousandthreehundredfortynine",     319349)>]
[<InlineData(                                          "onemillion",    1000000)>]
[<InlineData(                                       "onemillionone",    1000001)>]
[<InlineData(                                       "twomillionten",    2000010)>]
[<InlineData(                            "sixmillionthirtythousand",    6030000)>]
[<InlineData("ninemilliontwohundredonethousandsixhundredthirtyfour",    9201634)>]
[<InlineData(                                          "tenmillion",   10000000)>]
[<InlineData(                                      "tenmillionnine",   10000009)>]
[<InlineData(                                    "twentyonemillion",   21000000)>]
[<InlineData( "fortysevenmillioneighthundredthirtyonethousandsixty",   47831060)>]
[<InlineData(                                      "hundredmillion",  100000000)>]
[<InlineData(                                   "onehundredmillion",  100000000)>]
[<InlineData(                               "twohundredfivemillion",  205000000)>]
[<InlineData("fourhundredeightyninemillionsixtythousandfivehundred",  489060500)>]
[<InlineData(                                          "onebillion", 1000000000)>]
[<InlineData(                                          "twobillion", 2000000000)>]
[<InlineData("twobillionfortythreemillioneighthundredsixtythousand", 2043860000)>]
[<InlineData(
    "twobilliononehundredfortysevenmillionfourhundredeightythreethousandsixhundredfortyseven",
    System.Int32.MaxValue)>]
let ``ofEnglish returns correct result`` (english : string, expected : int) =
    let actual = Numeral.ofEnglish english
    expected =! actual<commit_msg>Adjusted a few test cases to stay within 80 chars<commit_after>﻿module Ploeh.Numsense.EnglishExamples

open Xunit
open Swensen.Unquote

[<Theory>]
[<InlineData(                                             "zero",          0)>]
[<InlineData(                                            " zero",          0)>]
[<InlineData(                                            "zero ",          0)>]
[<InlineData(                                         "  zero  ",          0)>]
[<InlineData(                                             "Zero",          0)>]
[<InlineData(                                             "ZERO",          0)>]
[<InlineData(                                          " zERo\t",          0)>]
[<InlineData(                                              "one",          1)>]
[<InlineData(                                              "ONE",          1)>]
[<InlineData(                                              "two",          2)>]
[<InlineData(                                             " two",          2)>]
[<InlineData(                                            "three",          3)>]
[<InlineData(                                          "three  ",          3)>]
[<InlineData(                                             "four",          4)>]
[<InlineData(                                          "  four ",          4)>]
[<InlineData(                                             "five",          5)>]
[<InlineData(                                             "FivE",          5)>]
[<InlineData(                                              "six",          6)>]
[<InlineData(                                          "  SIX  ",          6)>]
[<InlineData(                                            "seven",          7)>]
[<InlineData(                                        "    seVen",          7)>]
[<InlineData(                                            "eight",          8)>]
[<InlineData(                                            "eIGHT",          8)>]
[<InlineData(                                             "nine",          9)>]
[<InlineData(                                           "NiNe  ",          9)>]
[<InlineData(                                              "ten",         10)>]
[<InlineData(                                           "eleven",         11)>]
[<InlineData(                                           "twelve",         12)>]
[<InlineData(                                         "thirteen",         13)>]
[<InlineData(                                         "fourteen",         14)>]
[<InlineData(                                          "fifteen",         15)>]
[<InlineData(                                          "sixteen",         16)>]
[<InlineData(                                        "seventeen",         17)>]
[<InlineData(                                         "eighteen",         18)>]
[<InlineData(                                         "nineteen",         19)>]
[<InlineData(                                           "twenty",         20)>]
[<InlineData(                                        "twentyone",         21)>]
[<InlineData(                                           "thirty",         30)>]
[<InlineData(                                       "thirtyfour",         34)>]
[<InlineData(                                            "forty",         40)>]
[<InlineData(                                        "fortyfour",         44)>]
[<InlineData(                                            "fifty",         50)>]
[<InlineData(                                       "fiftyseven",         57)>]
[<InlineData(                                            "sixty",         60)>]
[<InlineData(                                        "sixtyfive",         65)>]
[<InlineData(                                          "seventy",         70)>]
[<InlineData(                                      "seventynine",         79)>]
[<InlineData(                                           "eighty",         80)>]
[<InlineData(                                        "eightysix",         86)>]
[<InlineData(                                           "ninety",         90)>]
[<InlineData(                                      "ninetythree",         93)>]
[<InlineData(                                          "hundred",        100)>]
[<InlineData(                                       "onehundred",        100)>]
[<InlineData(                                       "hundredone",        101)>]
[<InlineData(                                    "onehundredone",        101)>]
[<InlineData(                                       "twohundred",        200)>]
[<InlineData(                            "twohundredthirtyseven",        237)>]
[<InlineData(                          "threehundredseventyfive",        375)>]
[<InlineData(                                "fourhundredninety",        490)>]
[<InlineData(                            "fivehundredsixtythree",        563)>]
[<InlineData(                               "sixhundredeighteen",        618)>]
[<InlineData(                         "sevenhundredseventyseven",        777)>]
[<InlineData(                                 "eighthundredfive",        805)>]
[<InlineData(                             "ninehundredfiftynine",        959)>]
[<InlineData(                                         "thousand",       1000)>]
[<InlineData(                                      "onethousand",       1000)>]
[<InlineData(                                      "thousandone",       1001)>]
[<InlineData(                                   "onethousandtwo",       1002)>]
[<InlineData(                             "onethousandsixtyfour",       1064)>]
[<InlineData(                                      "twothousand",       2000)>]
[<InlineData(               "eightthousandsevenhundredtwentyone",       8721)>]
[<InlineData(                                      "tenthousand",      10000)>]
[<InlineData(                         "tenthousandonehundredone",      10101)>]
[<InlineData(          "twentythreethousandfivehundredsixtyfour",      23564)>]
[<InlineData(                                "eightythousandten",      80010)>]
[<InlineData(                                  "hundredthousand",     100000)>]
[<InlineData(                               "onehundredthousand",     100000)>]
[<InlineData(                            "onehundredthousandone",     100001)>]
[<InlineData("threehundrednineteenthousandthreehundredfortynine",     319349)>]
[<InlineData(                                       "onemillion",    1000000)>]
[<InlineData(                                    "onemillionone",    1000001)>]
[<InlineData(                                    "twomillionten",    2000010)>]
[<InlineData(                         "sixmillionthirtythousand",    6030000)>]
[<InlineData( "ninemilliontwohundredonethousandsixhundredeighty",    9201680)>]
[<InlineData(                                       "tenmillion",   10000000)>]
[<InlineData(                                   "tenmillionnine",   10000009)>]
[<InlineData(                                 "twentyonemillion",   21000000)>]
[<InlineData( "fortysevenmillionsixhundredsixtyonethousandsixty",   47661060)>]
[<InlineData(                                   "hundredmillion",  100000000)>]
[<InlineData(                                "onehundredmillion",  100000000)>]
[<InlineData(                            "twohundredfivemillion",  205000000)>]
[<InlineData("fourhundredsixtyonemillionsixtythousandsixhundred",  461060600)>]
[<InlineData(                                       "onebillion", 1000000000)>]
[<InlineData(                                       "twobillion", 2000000000)>]
[<InlineData("twobillionfortyninemillionsixhundredfiftythousand", 2049650000)>]
[<InlineData(
    "twobilliononehundredfortysevenmillionfourhundredeightythreethousandsixhundredfortyseven",
    System.Int32.MaxValue)>]
let ``ofEnglish returns correct result`` (english : string, expected : int) =
    let actual = Numeral.ofEnglish english
    expected =! actual
{'fraction_non_alphanumeric': 0.10941429009506286, 'fraction_numerical': 0.039742410303587855, 'mean_word_length': 0.8141967067200712, 'pattern_counts': {'":': 0, '<': 197, '<?xml version=': 0, '>': 197, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 10, 'word_list_counts': {'cursed_substrings.json': 259, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3936491', 'n_tokens_mistral': 3792, 'n_tokens_neox': 3553, 'n_words': 622}