1
exercism fetch fsharp bracket-push

BracketPushTest.fs

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
// This file was auto-generated based on version 1.1.0 of the canonical data.

module BracketPushTest

open FsUnit.Xunit
open Xunit

open BracketPush

[<Fact>]
let ``Paired square brackets`` () =
    isPaired "[]" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Empty string`` () =
    isPaired "" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Unpaired brackets`` () =
    isPaired "[[" |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Wrong ordered brackets`` () =
    isPaired "}{" |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Wrong closing bracket`` () =
    isPaired "{]" |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Paired with whitespace`` () =
    isPaired "{ }" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Simple nested brackets`` () =
    isPaired "{[]}" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Several paired brackets`` () =
    isPaired "{}[]" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Paired and nested brackets`` () =
    isPaired "([{}({}[])])" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Unopened closing brackets`` () =
    isPaired "{[)][]}" |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Unpaired and nested brackets`` () =
    isPaired "([{])" |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Paired and wrong nested brackets`` () =
    isPaired "[({]})" |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Math expression`` () =
    isPaired "(((185 + 223.85) * 15) - 543)/2" |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Complex latex expression`` () =
    isPaired "\left(\begin{array}{cc} \frac{1}{3} & x\\ \mathrm{e}^{x} &... x^2 \end{array}\right)" |> should equal true