test-cardinal.rkt
#lang racket/base

(require "cardinal.rkt"
         rackunit
         (for-syntax racket/base))

(define-syntax (ck stx)
  (syntax-case stx ()
    [(_ n e)
     (syntax/loc stx
       (check-equal? (number->cardinal n) e))]))

(ck 0 "zero")
(ck 1 "one")
(ck 2 "two")
(ck 3 "three")
(ck 4 "four")
(ck 5 "five")
(ck 6 "six")
(ck 7 "seven")
(ck 8 "eight")
(ck 9 "nine")
(ck 10 "ten")
(ck 11 "eleven")
(ck 12 "twelve")
(ck 13 "thirteen")
(ck 14 "fourteen")
(ck 15 "fifteen")
(ck 16 "sixteen")
(ck 17 "seventeen")
(ck 18 "eighteen")
(ck 19 "nineteen")
(ck 20 "twenty")
(ck 21 "twenty-one")
(ck 22 "twenty-two")
(ck 23 "twenty-three")
(ck 24 "twenty-four")
(ck 25 "twenty-five")
(ck 26 "twenty-six")
(ck 27 "twenty-seven")
(ck 28 "twenty-eight")
(ck 29 "twenty-nine")
(ck 30 "thirty")
(ck 40 "forty")
(ck 50 "fifty")
(ck 60 "sixty")
(ck 70 "seventy")
(ck 80 "eighty")
(ck 90 "ninety")
(ck 100 "one hundred")
(ck 101 "one hundred one")
(ck 102 "one hundred two")
(ck 110 "one hundred ten")
(ck 120 "one hundred twenty")
(ck 200 "two hundred")
(ck 215 "two hundred fifteen")
(ck 300 "three hundred")
(ck 400 "four hundred")
(ck 492 "four hundred ninety-two")
(ck 500 "five hundred")
(ck 600 "six hundred")
(ck 700 "seven hundred")
(ck 800 "eight hundred")
(ck 900 "nine hundred")
(ck 1000 "one thousand")
(ck 1001 "one thousand one")
(ck 1010 "one thousand ten")
(ck 2000 "two thousand")
(ck 10000 "ten thousand")
(ck 11000 "eleven thousand")
(ck 100000 "one hundred thousand")
(ck 200000 "two hundred thousand")
(ck 1000000 "one million")
(ck 1200000 "one million two hundred thousand")
(ck 2000000 "two million")
(ck 999000 "nine hundred ninety-nine thousand")
(ck 999999 "nine hundred ninety-nine thousand nine hundred ninety-nine")
(ck 999999999 "nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine")
(ck 1000000000 "one billion")
(ck 999999999999999999999999999999999999999999999999999999999999999999
    "nine hundred ninety-nine vigintillion nine hundred ninety-nine novemdecillion nine hundred ninety-nine octodecillion nine hundred ninety-nine septendecillion nine hundred ninety-nine sexdecillion nine hundred ninety-nine quindecillion nine hundred ninety-nine quattuordecillion nine hundred ninety-nine tredecillion nine hundred ninety-nine duodecillion nine hundred ninety-nine undecillion nine hundred ninety-nine decillion nine hundred ninety-nine nonillion nine hundred ninety-nine octillion nine hundred ninety-nine septillion nine hundred ninety-nine sextillion nine hundred ninety-nine quintillion nine hundred ninety-nine quadrillion nine hundred ninety-nine trillion nine hundred ninety-nine billion nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine")

;; And that's the maximum number we can coerse.
(check-exn exn:fail?
           (lambda ()
             (number->cardinal (add1 999999999999999999999999999999999999999999999999999999999999999999))))