 
   end
 end
+
+# run this benchmark with "elixir #{__ENV__.file} bm"
+if System.argv |> List.first == "bm" do
+  defmodule Time do
+    def now, do: ({msecs, secs, musecs} = :erlang.now; (msecs*1000000 + secs)*1000000 + musecs)
+  end
+  defmodule BM do
+    def times(0, f), do: f.()
+    def times(n, f) do
+      f.()
+      times(n-1, f)
+    end
+    def go(f) do
+      start = Time.now
+      times(1000, f)
+      tot = Time.now - start
+      ops_per_mus = 1000/tot
+      ops_per_s = ops_per_mus * 1000000
+      IO.puts ops_per_s
+      ops_per_s
+    end
+  end
+  BM.go(fn ->
+    NumbersToWords.parse(:random.uniform(999999999999999999999))
+  end)
+end

    use ExUnit.Case, async: true

    test "digits to words" do
      %{
        zero: 0, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,
        eleven: 11, twelve: 12, thirteen: 13, fourteen: 14, fifteen: 15, sixteen: 16, seventeen: 17,
        eighteen: 18, nineteen: 19
      }
      |>
      Enum.each(fn {word, num} ->
        assert to_string(word) == NumbersToWords.parse(num)
      end)
    end


# Numbers to Words

# Original implementation using binary matching:
# The problem with this version is it's 10 times slower than the one below it, based on some simple benchmarking.
# I've left it in for posterity/educational reasons.

# defmodule NumbersToWords do

