Skip to content

Commit

Permalink
Merge pull request #282 from pineman/03_numbers_use_threequals
Browse files Browse the repository at this point in the history
Highlight that Float functions returns float
  • Loading branch information
iamvery committed Jul 10, 2023
2 parents a2eaef1 + 22dc340 commit da8c5ac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions lib/koans/03_numbers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/koans/12_pattern_matching.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 == {___, ___}
Expand Down
2 changes: 1 addition & 1 deletion lib/koans/13_functions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/koans/functions_koans_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down

0 comments on commit da8c5ac

Please sign in to comment.