Last active
May 18, 2019 20:23
-
-
Save IlyaOsotov/7cde9535b0e050a7869fd31198cd1108 to your computer and use it in GitHub Desktop.
Revisions
-
IlyaOsotov revised this gist
May 18, 2019 . 1 changed file with 24 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ defmodule FactorialTest do use ExUnit.Case doctest Factorial test "factorial 0" do assert Factorial.call(0) == 1 end test "factorial 5" do assert Factorial.call(5) == 120 end test "factorial 3" do assert Factorial.call(3) == 6 end end # ilya@ilya-UX303LN:~/Repository/factorial$ mix test # ... # # Finished in 0.03 seconds # 3 tests, 0 failures # # Randomized with seed 947461 -
IlyaOsotov created this gist
May 18, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ defmodule Factorial do def call(n) do case n do 0 -> 1 _ -> n * call(n-1) end end end