1
exercism fetch elixir diamond

diamond_test.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
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("diamond.exs", __DIR__)
end

ExUnit.start
ExUnit.configure exclude: :pending, trace: true

defmodule DiamondTest do
  use ExUnit.Case

  # @tag :pending
  test "letter A" do
    shape = Diamond.build_shape(?A)
    assert shape == "A\n"
  end

  @tag :pending
  test "letter C" do
    shape = Diamond.build_shape(?C)
    assert shape == """
\s A \s
\sB B\s
 C   C
\sB B\s
\s A \s
    """
  end

  @tag :pending
  test "letter E" do
    shape = Diamond.build_shape(?E)
    assert shape == """
\s   A   \s
\s  B B  \s
\s C   C \s
\sD     D\s
 E       E
\sD     D\s
\s C   C \s
\s  B B  \s
\s   A   \s
    """
  end
end