Skip to content

Commit

Permalink
Merge pull request #6 from jakewilliami/dev
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
jakewilliami authored Oct 28, 2020
2 parents 61619ce + 84561ec commit 90cbb00
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SpelledOut"
uuid = "4728c690-e668-4265-bc0d-51a8c0f93067"
authors = ["Jake W. Ireland <[email protected]> and contributors"]
version = "0.1.0"
version = "0.1.1"

[compat]
julia = "1"
Expand Down
44 changes: 23 additions & 21 deletions src/standard_dictionary_numbers_extended.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,35 @@ const _scale_modern = String[
"thousand", "million", "billion", "trillion", "quadrillion",
"quintillion", "sextillion", "septillion", "octillion", "nonillion",
"decillion", "undecillion", "duodecillion", "tredecillion", "quattuordecillion",
"sexdecillion", "septendecillion", "octodecillion", "novemdecillion", "vigintillion",
"unvigintillion", "duovigintillion", "tresvigintillion", "quattuorvigintillion", "quinvigintillion",
"sesvigintillion", "septemvigintillion", "octovigintillion", "novemvigintillion", "trigintillion",
"untrigintillion", "duotrigintillion", "trestrigintillion", "quattuortrigintillion", "quintrigintillion",
"sestrigintillion", "septentrigintillion", "octotrigintillion", "noventrigintillion", "quadragintillion"
"quindecillion", "sexdecillion", "septendecillion", "octodecillion", "novemdecillion",
"vigintillion", "unvigintillion", "duovigintillion", "tresvigintillion", "quattuorvigintillion",
"quinvigintillion", "sesvigintillion", "septemvigintillion", "octovigintillion", "novemvigintillion",
"trigintillion", "untrigintillion", "duotrigintillion", "trestrigintillion", "quattuortrigintillion",
"quintrigintillion", "sestrigintillion", "septentrigintillion", "octotrigintillion", "noventrigintillion",
"quadragintillion"
]

const _scale_traditional_british = String[
"million", "thousand million", "billion", "thousand billion", "trillion",
"thousand trillion", "quadrillion", "thousand quadrillion", "quintillion", "thousand quintillion",
"sextillion", "thousand sextillion", "septillion", "thousand septillion", "octillion",
"thousand octillion", "nonillion", "thousand nonillion", "decillion", "thousand decillion",
"undecillion", "thousand undecillion", "duodecillion", "thousand duodecillion", "tredecillion",
"thousand tredecillion", "quattuordecillion", "thousand quattuordecillion","quindecillion", "thousand quindecillion",
"sedecillion", "thousand sedecillion", "septendecillion", "thousand septendecillion","octodecillion",
"thousand octodecillion","novendecillion", "thousand novendecillion", "vigintillion", "thousand vigintillion"
"thousand", "million", "thousand million", "billion", "thousand billion",
"trillion", "thousand trillion", "quadrillion", "thousand quadrillion", "quintillion",
"thousand quintillion", "sextillion", "thousand sextillion", "septillion", "thousand septillion", "octillion", "thousand octillion", "nonillion", "thousand nonillion", "decillion",
"thousand decillion", "undecillion", "thousand undecillion", "duodecillion", "thousand duodecillion",
"tredecillion", "thousand tredecillion", "quattuordecillion", "thousand quattuordecillion","quindecillion",
"thousand quindecillion","sedecillion", "thousand sedecillion", "septendecillion", "thousand septendecillion",
"octodecillion", "thousand octodecillion","novendecillion", "thousand novendecillion", "vigintillion",
"thousand vigintillion"
]

const _scale_traditional_european = String[
"million", "milliard", "billion", "billiard", "trillion",
"trilliard", "quadrillion", "quadrilliard", "quintillion", "quintilliard",
"sextillion", "sextilliard", "septillion", "septilliard", "octillion",
"octilliard", "nonillion", "nonilliard", "decillion", "decilliard",
"undecillion", "undecilliard", "duodecillion", "duodecilliard", "tredecillion",
"tredecilliard", "quattuordecillion", "quattuordecilliard","quindecillion", "quindecilliard",
"sedecillion", "sedecilliard", "septendecillion", "septendecilliard", "octodecillion",
"octodecilliard", "novendecillion", "novendecilliard", "vigintillion", "vigintilliard"
"thousand", "million", "milliard", "billion", "billiard",
"trillion", "trilliard", "quadrillion", "quadrilliard", "quintillion",
"quintilliard", "sextillion", "sextilliard", "septillion", "septilliard",
"octillion", "octilliard", "nonillion", "nonilliard", "decillion",
"decilliard", "undecillion", "undecilliard", "duodecillion", "duodecilliard",
"tredecillion", "tredecilliard", "quattuordecillion", "quattuordecilliard", "quindecillion",
"quindecilliard", "sedecillion", "sedecilliard", "septendecillion", "septendecilliard",
"octodecillion", "octodecilliard", "novendecillion", "novendecilliard", "vigintillion",
"vigintilliard"
]

const limit = BigInt(big(10)^120)
14 changes: 10 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env bash
#=
exec julia --project="$(realpath $(dirname $(realpath $(dirname $0))))/examples/" "${BASH_SOURCE[0]}" "$@" -e "include(popfirst!(ARGS))" \
"${BASH_SOURCE[0]}" "$@"
=#

include(joinpath(dirname(dirname(@__FILE__)), "src", "SpelledOut.jl"))

using .SpelledOut
Expand All @@ -15,9 +21,9 @@ using Test
@test spelled_out(0, british=true) == "zero"
@test spelled_out(100) == "one hundred"
@test spelled_out(100, british=true) == "one hundred"
@test spelled_out(123456789, british=true, dict=:european)== "one hundred and thirty-three milliard, four hundred and fifty-six million, seven hundred and eighty-nine"
@test spelled_out(123456789, dict=:european) == "one hundred thirty-three milliard, four hundred fifty-six million, seven hundred eighty-nine"
@test spelled_out(123456789, british=true, dict=:british) == "one hundred and thirty-three thousand million, four hundred and fifty-six million, seven hundred and eighty-nine"
@test spelled_out(1234567890123, british=true, dict=:british) == "one thousand billion, two hundred and thirty-four billion, five hundred and sixty-seven thousand million, eight hundred and ninety million, one hundred and thirty-three"
@test spelled_out(123456789, british=true, dict=:european) == "one hundred and thirty-three million, four hundred and fifty-six thousand, seven hundred and eighty-nine"
@test spelled_out(123456789, dict=:european) == "one hundred thirty-three million, four hundred fifty-six thousand, seven hundred eighty-nine"
@test spelled_out(123456789, british=true, dict=:british) == "one hundred and thirty-three million, four hundred and fifty-six thousand, seven hundred and eighty-nine"
@test spelled_out(1234567890123, british=true, dict=:british) == "one billion, two hundred and thirty-four thousand million, five hundred and sixty-seven million, eight hundred and ninety thousand, one hundred and thirty-three"
@test spelled_out(1234567890123, british=true, dict=:modern) == "one trillion, two hundred and thirty-four billion, five hundred and sixty-seven million, eight hundred and ninety thousand, one hundred and thirty-three"
end

0 comments on commit 90cbb00

Please sign in to comment.