2019-02-06 05:59:24 +03:00
|
|
|
:: tests for number-to-words
|
|
|
|
::
|
|
|
|
/+ number-to-words, *test
|
|
|
|
::
|
|
|
|
|%
|
2019-02-07 02:58:43 +03:00
|
|
|
++ test-eng-us
|
|
|
|
=+ eng-us:number-to-words
|
2019-02-06 05:59:24 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"zero"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 0)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 1)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"twelve"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 12)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"twenty"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 20)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"ninety-nine"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 99)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one hundred"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 100)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one hundred and eleven"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 111)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one thousand"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 1.000)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one thousand, one hundred and eleven"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 1.111)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one million and one"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 1.000.001)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one trillion"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words (pow 10 12))
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ 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"
|
|
|
|
==
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words 18.446.744.073.709.551.616)
|
2019-02-06 05:59:24 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> `(unit tape)``"one vigintillion"
|
2019-02-07 02:58:43 +03:00
|
|
|
!> (to-words (pow 10 63))
|
2019-02-06 05:59:24 +03:00
|
|
|
==
|
|
|
|
--
|