diff --git a/lib/koans/03_numbers.ex b/lib/koans/03_numbers.ex index 4b70f99..712c05c 100644 --- a/lib/koans/03_numbers.ex +++ b/lib/koans/03_numbers.ex @@ -4,6 +4,38 @@ defmodule Numbers do @intro "Why is the number six so scared? Because seven eight nine!\nWe should get to know numbers a bit more!" + koan "Is an integer equal to its float equivalent?" do + assert 1 == 1.0 == ___ + end + + koan "Is an integer threequal to its float equivalent?" do + assert 1 === 1.0 == ___ + end + + koan "Revisit divison with threequal" do + assert 2 / 2 === ___ + end + + koan "Another way to divide" do + assert div(5, 2) == ___ + end + + koan "Other math operators may produce this" do + assert 2 * 2 === ___ + end + + koan "Or other math operators may produce this" do + assert 2 * 2.0 === ___ + end + + koan "Two ways to round, are they exactly the same?" do + assert Float.round(1.2) === round(1.2) == ___ + end + + koan "Release the decimals into the void" do + assert trunc(5.6) === ___ + end + koan "Are you odd?" do assert Integer.is_odd(3) == ___ end diff --git a/test/koans/numbers_koans_test.exs b/test/koans/numbers_koans_test.exs index 0c3847c..4cb54c5 100644 --- a/test/koans/numbers_koans_test.exs +++ b/test/koans/numbers_koans_test.exs @@ -4,6 +4,14 @@ defmodule NumbersTests do test "Numbers" do answers = [ + true, + false, + 1.0, + 2, + 4, + 4.0, + false, + 5, true, true, [5, 8, 1, 2, 7],