more number koans
This commit is contained in:
@@ -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
|
||||
|
@@ -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],
|
||||
|
Reference in New Issue
Block a user