1
exercism fetch elixir bracket-push

bracket_push_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("bracket_push.exs", __DIR__)
end

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

defmodule BracketPushTest do
  use ExUnit.Case

  # @tag :pending
  test "paired square brackets" do
    assert BracketPush.check_brackets("[]")
  end

  @tag :pending
  test "empty string" do
    assert BracketPush.check_brackets("")
  end

  @tag :pending
  test "unpaired brackets" do
    refute BracketPush.check_brackets("[[")
  end

  @tag :pending
  test "wrong ordered brackets" do
    refute BracketPush.check_brackets("}{")
  end

  @tag :pending
  test "wrong closing bracket" do
    refute BracketPush.check_brackets("{]")
  end

  @tag :pending
  test "paired with whitespace" do
    assert BracketPush.check_brackets("{ }")
  end

  @tag :pending
  test "simple nested brackets" do
    assert BracketPush.check_brackets("{[]}")
  end

  @tag :pending
  test "several paired brackets" do
    assert BracketPush.check_brackets("{}[]")
  end

  @tag :pending
  test "paired and nested brackets" do
    assert BracketPush.check_brackets("([{}({}[])])")
  end

  @tag :pending
  test "unopened closing brackets" do
    refute BracketPush.check_brackets("{[)][]}")
  end

  @tag :pending
  test "unpaired and nested brackets" do
    refute BracketPush.check_brackets("([{])")
  end

  @tag :pending
  test "paired and wrong nested brackets" do
    refute BracketPush.check_brackets("[({]})")
  end

  @tag :pending
  test "math expression" do
    assert BracketPush.check_brackets("(((185 + 223.85) * 15) - 543)/2")
  end

  @tag :pending
  test "complex latex expression" do
    assert BracketPush.check_brackets("\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)")
  end
end