forked from exercism/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update bracket-push to match latest canonical json.
Refs exercism#488
- Loading branch information
Showing
2 changed files
with
18 additions
and
16 deletions.
There are no files selected for viewing
32 changes: 17 additions & 15 deletions
32
exercises/bracket-push/src/test/scala/BracketPushTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,76 @@ | ||
import org.scalatest.{Matchers, FunSuite} | ||
|
||
/** @version 1.1.0 */ | ||
/** @version 1.2.0 */ | ||
class BracketPushTest extends FunSuite with Matchers { | ||
|
||
test("paired square brackets") { | ||
BracketPush.isPaired("[]") should be (true) | ||
BracketPush.isPaired("[]") should be(true) | ||
} | ||
|
||
test("empty string") { | ||
pending | ||
BracketPush.isPaired("") should be (true) | ||
BracketPush.isPaired("") should be(true) | ||
} | ||
|
||
test("unpaired brackets") { | ||
pending | ||
BracketPush.isPaired("[[") should be (false) | ||
BracketPush.isPaired("[[") should be(false) | ||
} | ||
|
||
test("wrong ordered brackets") { | ||
pending | ||
BracketPush.isPaired("}{") should be (false) | ||
BracketPush.isPaired("}{") should be(false) | ||
} | ||
|
||
test("wrong closing bracket") { | ||
pending | ||
BracketPush.isPaired("{]") should be (false) | ||
BracketPush.isPaired("{]") should be(false) | ||
} | ||
|
||
test("paired with whitespace") { | ||
pending | ||
BracketPush.isPaired("{ }") should be (true) | ||
BracketPush.isPaired("{ }") should be(true) | ||
} | ||
|
||
test("simple nested brackets") { | ||
pending | ||
BracketPush.isPaired("{[]}") should be (true) | ||
BracketPush.isPaired("{[]}") should be(true) | ||
} | ||
|
||
test("several paired brackets") { | ||
pending | ||
BracketPush.isPaired("{}[]") should be (true) | ||
BracketPush.isPaired("{}[]") should be(true) | ||
} | ||
|
||
test("paired and nested brackets") { | ||
pending | ||
BracketPush.isPaired("([{}({}[])])") should be (true) | ||
BracketPush.isPaired("([{}({}[])])") should be(true) | ||
} | ||
|
||
test("unopened closing brackets") { | ||
pending | ||
BracketPush.isPaired("{[)][]}") should be (false) | ||
BracketPush.isPaired("{[)][]}") should be(false) | ||
} | ||
|
||
test("unpaired and nested brackets") { | ||
pending | ||
BracketPush.isPaired("([{])") should be (false) | ||
BracketPush.isPaired("([{])") should be(false) | ||
} | ||
|
||
test("paired and wrong nested brackets") { | ||
pending | ||
BracketPush.isPaired("[({]})") should be (false) | ||
BracketPush.isPaired("[({]})") should be(false) | ||
} | ||
|
||
test("math expression") { | ||
pending | ||
BracketPush.isPaired("(((185 + 223.85) * 15) - 543)/2") should be (true) | ||
BracketPush.isPaired("(((185 + 223.85) * 15) - 543)/2") should be(true) | ||
} | ||
|
||
test("complex latex expression") { | ||
pending | ||
BracketPush.isPaired("\\\\left(\\\\begin{array}{cc} \\\\frac{1}{3} & x\\\\\\\\ \\\\mathrm{e}^{x} &... x^2 \\\\end{array}\\\\right)") should be (true) | ||
BracketPush.isPaired( | ||
"\\left(\\begin{array}{cc} \\frac{1}{3} & x\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)") should be( | ||
true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters