Merge pull request #282 from pineman/03_numbers_use_threequals

Highlight that Float functions returns float
This commit is contained in:
Jay Hayes
2023-07-10 09:29:00 -05:00
committed by GitHub
4 changed files with 11 additions and 11 deletions

View File

@@ -86,26 +86,26 @@ defmodule Numbers do
end
koan "I don't want this decimal point, let's round up" do
assert Float.ceil(34.25) == ___
assert Float.ceil(34.25) === ___
end
koan "OK, I only want it to 1 decimal place" do
assert Float.ceil(34.25, 1) == ___
assert Float.ceil(34.25, 1) === ___
end
koan "Rounding down is what I need" do
assert Float.floor(99.99) == ___
assert Float.floor(99.99) === ___
end
koan "Rounding down to 2 decimal places" do
assert Float.floor(12.345, 2) == ___
assert Float.floor(12.345, 2) === ___
end
koan "Round the number up or down for me" do
assert Float.round(5.5) == ___
assert Float.round(5.4) == ___
assert Float.round(8.94, 1) == ___
assert Float.round(-5.5674, 3) == ___
assert Float.round(5.5) === ___
assert Float.round(5.4) === ___
assert Float.round(8.94, 1) === ___
assert Float.round(-5.5674, 3) === ___
end
koan "I want the first and last in the range" do

View File

@@ -45,7 +45,7 @@ defmodule PatternMatching do
end
end
koan "So does the keyword lists" do
koan "So must keyword lists" do
kw_list = [type: "car", year: 2016, make: "Honda"]
[_type | [_year | [tuple]]] = kw_list
assert tuple == {___, ___}

View File

@@ -25,7 +25,7 @@ defmodule Functions do
assert first("One") == ___
end
def repeat_again(message, times \\ 5) do
def repeat_again(message, times \\ 3) do
String.duplicate(message, times)
end

View File

@@ -7,7 +7,7 @@ defmodule FunctionsTests do
"Hello, World!",
3,
{:multiple, ["One and Two", "Only One"]},
{:multiple, ["Hello Hello Hello Hello Hello ", "Hello Hello "]},
{:multiple, ["Hello Hello Hello ", "Hello Hello "]},
{:multiple, [:entire_list, :single_thing]},
{:multiple, ["10 is bigger than 5", "4 is not bigger than 27"]},
{:multiple, ["The number was zero", "The number was 5"]},