Merge pull request #131 from iamvery/list-koans

List koans
This commit is contained in:
Uku Taht
2016-06-13 23:15:19 +01:00
committed by GitHub
2 changed files with 9 additions and 4 deletions

View File

@@ -20,11 +20,11 @@ defmodule Lists do
end
koan "Evolution can have different forms" do
assert List.delete([1, 2, 2, 3], 2) == ___
assert List.delete([:a, :b, :c], :b) == ___
end
koan "Precision is also valued" do
assert List.delete_at([1, 2, 3], 1) == ___
assert List.delete_at([:a, :b, :c], 2) == ___
end
koan "Replication is also possible" do
@@ -63,6 +63,10 @@ defmodule Lists do
assert List.wrap("value") == ___
end
koan "Wrapping nothing produces a list of nothing" do
assert List.wrap(nil) == ___
end
koan "When there is already a list do not wrap it again" do
assert List.wrap(["value"]) == ___
end

View File

@@ -7,8 +7,8 @@ defmodule ListsTests do
3,
[1, 2, :a, "b"],
[1,2],
[1,2,3],
[1,3],
[:a, :c],
[:a, :b],
["life", "life", "life"],
[1, 2, 3, 4, 5],
[1, 4, 2, 3],
@@ -18,6 +18,7 @@ defmodule ListsTests do
[1, 2, 3, 4],
{1, 2, 3},
["value"],
[],
["value"],
]