urbit/tests/lib/number-to-words.hoon
fang e888960370
tests: move to root, out of pkg/arvo
Including these in pkg/arvo has caused many minor problems over the
years. We don't want to include them in releases, but this often meant
excluding them manually, which was error-prone.

Here, we move them out of /pkg/arvo/tests and into /tests. CI will have
to be updated to match, since we'll still want to include tests there.
2023-01-18 16:50:42 +01:00

70 lines
1.6 KiB
Plaintext

:: tests for number-to-words
::
/+ number-to-words, *test
::
|%
++ test-eng-us
=+ eng-us:number-to-words
;: weld
%+ expect-eq
!> `(unit tape)``"zero"
!> (to-words 0)
::
%+ expect-eq
!> `(unit tape)``"one"
!> (to-words 1)
::
%+ expect-eq
!> `(unit tape)``"twelve"
!> (to-words 12)
::
%+ expect-eq
!> `(unit tape)``"twenty"
!> (to-words 20)
::
%+ expect-eq
!> `(unit tape)``"ninety-nine"
!> (to-words 99)
::
%+ expect-eq
!> `(unit tape)``"one hundred"
!> (to-words 100)
::
%+ expect-eq
!> `(unit tape)``"one hundred and eleven"
!> (to-words 111)
::
%+ expect-eq
!> `(unit tape)``"one thousand"
!> (to-words 1.000)
::
%+ expect-eq
!> `(unit tape)``"one thousand, one hundred and eleven"
!> (to-words 1.111)
::
%+ expect-eq
!> `(unit tape)``"one million and one"
!> (to-words 1.000.001)
::
%+ expect-eq
!> `(unit tape)``"one trillion"
!> (to-words (pow 10 12))
::
%+ expect-eq
!>
^- (unit tape)
:- ~
;: weld
"eighteen quintillion, four hundred and forty-six quadrillion, seven "
"hundred and forty-four trillion, seventy-three billion, seven "
"hundred and nine million, five hundred and fifty-one thousand, six "
"hundred and sixteen"
==
!> (to-words 18.446.744.073.709.551.616)
::
%+ expect-eq
!> `(unit tape)``"one vigintillion"
!> (to-words (pow 10 63))
==
--