defmodule SayTest do use ExUnit.Case test "zero" do assert Say.in_english(0) == {:ok, "zero"} end test "one" do assert Say.in_english(1) == {:ok, "one"} end test "fourteen" do assert Say.in_english(14) == {:ok, "fourteen"} end test "twenty" do assert Say.in_english(20) == {:ok, "twenty"} end test "twenty-two" do assert Say.in_english(22) == {:ok, "twenty-two"} end test "thirty" do assert Say.in_english(30) == {:ok, "thirty"} end test "ninety-nine" do assert Say.in_english(99) == {:ok, "ninety-nine"} end test "one hundred" do assert Say.in_english(100) == {:ok, "one hundred"} end test "one hundred twenty-three" do assert Say.in_english(123) == {:ok, "one hundred twenty-three"} end test "two hundred" do assert Say.in_english(200) == {:ok, "two hundred"} end test "nine hundred ninety-nine" do assert Say.in_english(999) == {:ok, "nine hundred ninety-nine"} end test "one thousand" do assert Say.in_english(1_000) == {:ok, "one thousand"} end test "one thousand two hundred thirty-four" do assert Say.in_english(1_234) == {:ok, "one thousand two hundred thirty-four"} end test "one million" do assert Say.in_english(1_000_000) == {:ok, "one million"} end test "one million two thousand three hundred forty-five" do assert Say.in_english(1_002_345) == {:ok, "one million two thousand three hundred forty-five"} end test "one billion" do assert Say.in_english(1_000_000_000) == {:ok, "one billion"} end test "a big number" do assert Say.in_english(987_654_321_123) == {:ok, "nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three"} end test "numbers below zero are out of range" do assert Say.in_english(-1) == {:error, "number is out of range"} end test "numbers above 999,999,999,999 are out of range" do assert Say.in_english(1_000_000_000_000) == {:error, "number is out of range"} end end