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.
Rename bracket-push exercise to matching-brackets.
Refs exercism#607
- Loading branch information
Showing
9 changed files
with
90 additions
and
88 deletions.
There are no files selected for viewing
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
81 changes: 0 additions & 81 deletions
81
exercises/bracket-push/src/test/scala/BracketPushTest.scala
This file was deleted.
Oops, something went wrong.
7 changes: 4 additions & 3 deletions
7
exercises/bracket-push/README.md → exercises/matching-brackets/README.md
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
exercises/bracket-push/example.scala → exercises/matching-brackets/example.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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=0.13.15 |
File renamed without changes.
81 changes: 81 additions & 0 deletions
81
exercises/matching-brackets/src/test/scala/MatchingBracketsTest.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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import org.scalatest.{Matchers, FunSuite} | ||
|
||
/** @version 1.3.0 */ | ||
class MatchingBracketsTest extends FunSuite with Matchers { | ||
|
||
test("paired square brackets") { | ||
MatchingBrackets.isPaired("[]") should be(true) | ||
} | ||
|
||
test("empty string") { | ||
//pending | ||
MatchingBrackets.isPaired("") should be(true) | ||
} | ||
|
||
test("unpaired brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("[[") should be(false) | ||
} | ||
|
||
test("wrong ordered brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("}{") should be(false) | ||
} | ||
|
||
test("wrong closing bracket") { | ||
//pending | ||
MatchingBrackets.isPaired("{]") should be(false) | ||
} | ||
|
||
test("paired with whitespace") { | ||
//pending | ||
MatchingBrackets.isPaired("{ }") should be(true) | ||
} | ||
|
||
test("partially paired brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("{[])") should be(false) | ||
} | ||
|
||
test("simple nested brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("{[]}") should be(true) | ||
} | ||
|
||
test("several paired brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("{}[]") should be(true) | ||
} | ||
|
||
test("paired and nested brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("([{}({}[])])") should be(true) | ||
} | ||
|
||
test("unopened closing brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("{[)][]}") should be(false) | ||
} | ||
|
||
test("unpaired and nested brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("([{])") should be(false) | ||
} | ||
|
||
test("paired and wrong nested brackets") { | ||
//pending | ||
MatchingBrackets.isPaired("[({]})") should be(false) | ||
} | ||
|
||
test("math expression") { | ||
//pending | ||
MatchingBrackets.isPaired("(((185 + 223.85) * 15) - 543)/2") should be(true) | ||
} | ||
|
||
test("complex latex expression") { | ||
//pending | ||
MatchingBrackets.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