forked from dojo-toulouse/elixir-koans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
about_lists.exs
executable file
·44 lines (34 loc) · 1.04 KB
/
about_lists.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env elixir
ExUnit.start
defmodule About_Lists do
use ExUnit.Case
use Koans
think "Create your first list" do
a_list = __?
assert is_list(a_list)
end
think "Getting list length is a kernel feature" do
a_list = [1, 2, 3]
assert length(a_list) == __?
end
think "Elixir provide special operator to concatenate lists" do
a_list = [1, 2]
assert a_list ++ [3] == __?
end
think "Elixir provide special operator to remove element from list" do
a_list = [1, 2, 3]
assert a_list -- [2] == __?
end
think "Only first element is removed with truncate operator" do
a_list = [:foo, :bar, :foo]
assert a_list -- [:foo] == __?
end
think "Truncate operator do nothing when element not in list" do
a_list = [:foo, :bar]
assert_? a_list -- [:baz] == [:foo, :bar]
end
think "The in operator test if element is present inner an enum" do
a_list = [:foo, :bar]
assert_? :bar in a_list
end
end