-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_about_lists.exs
executable file
·43 lines (33 loc) · 1.02 KB
/
03_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
#!/usr/bin/env elixir
ExUnit.start
defmodule About_Lists do
use ExUnit.Case
test "Create your first list" do
a_list = __?
assert is_list(a_list)
end
test "Getting list lenght is a kernel feature" do
a_list = [1, 2, 3]
assert length(a_list) == __?
end
test "Elixir provide special operator to concatenate lists" do
a_list = [1, 2]
assert a_list ++ [3] == __?
end
test "Elixir provide special operator to remove element from list" do
a_list = [1, 2, 3]
assert a_list -- [2] == __?
end
test "Only first element is removed with truncate operator" do
a_list = [:foo, :bar, :foo]
assert a_list -- [:foo] == __?
end
test "Truncate operator do nothing when element not in list" do
a_list = [:foo, :bar]
assert_? a_list -- [:baz] == [:foo, :bar]
end
test "The in operator test if element is present inner an enum" do
a_list = [:foo, :bar]
assert_? :bar in a_list
end
end