File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,42 @@ defmodule Numbers do
44
55 @ intro "Why is the number six so scared? Because seven eight nine!\n We should get to know numbers a bit more!"
66
7+ koan "Is an integer equal to its float equivalent?" do
8+ assert 1 == 1.0 == ___
9+ end
10+
11+ koan "Is an integer threequal to its float equivalent?" do
12+ assert 1 === 1.0 == ___
13+ end
14+
15+ koan "Revisit divison with threequal" do
16+ assert 2 / 2 === ___
17+ end
18+
19+ koan "Another way to divide" do
20+ assert div ( 5 , 2 ) == ___
21+ end
22+
23+ koan "What remains or: The Case of the Missing Modulo Operator (%)" do
24+ assert rem ( 5 , 2 ) == ___
25+ end
26+
27+ koan "Other math operators may produce this" do
28+ assert 2 * 2 === ___
29+ end
30+
31+ koan "Or other math operators may produce this" do
32+ assert 2 * 2.0 === ___
33+ end
34+
35+ koan "Two ways to round, are they exactly the same?" do
36+ assert Float . round ( 1.2 ) === round ( 1.2 ) == ___
37+ end
38+
39+ koan "Release the decimals into the void" do
40+ assert trunc ( 5.6 ) === ___
41+ end
42+
743 koan "Are you odd?" do
844 assert Integer . is_odd ( 3 ) == ___
945 end
Original file line number Diff line number Diff line change @@ -4,6 +4,15 @@ defmodule NumbersTests do
44
55 test "Numbers" do
66 answers = [
7+ true ,
8+ false ,
9+ 1.0 ,
10+ 2 ,
11+ 1 ,
12+ 4 ,
13+ 4.0 ,
14+ false ,
15+ 5 ,
716 true ,
817 true ,
918 [ 5 , 8 , 1 , 2 , 7 ] ,
You can’t perform that action at this time.
0 commit comments