Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync matching-brackets exercise #261

Merged
merged 1 commit into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions exercises/practice/matching-brackets/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,21 @@ description = "unpaired and nested brackets"
[a0205e34-c2ac-49e6-a88a-899508d7d68e]
description = "paired and wrong nested brackets"

[1d5c093f-fc84-41fb-8c2a-e052f9581602]
description = "paired and wrong nested brackets but innermost are correct"

[ef47c21b-bcfd-4998-844c-7ad5daad90a8]
description = "paired and incomplete brackets"

[a4675a40-a8be-4fc2-bc47-2a282ce6edbe]
description = "too many closing brackets"

[a345a753-d889-4b7e-99ae-34ac85910d1a]
description = "early unexpected brackets"

[21f81d61-1608-465a-b850-baa44c5def83]
description = "early mismatched brackets"

[99255f93-261b-4435-a352-02bdecc9bdf2]
description = "math expression"

Expand Down
10 changes: 9 additions & 1 deletion exercises/practice/matching-brackets/test.sml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* version 1.4.0 *)
(* version 1.5.0 *)

use "testlib.sml";
use "matching-brackets.sml";
Expand Down Expand Up @@ -34,8 +34,16 @@ val testsuite =
(fn _ => isBalanced "([{])" |> Expect.falsy),
test "paired and wrong nested brackets"
(fn _ => isBalanced "[({]})" |> Expect.falsy),
test "paired and wrong nested brackets but innermost are correct"
(fn _ => isBalanced "[({}])" |> Expect.falsy),
test "paired and incomplete brackets"
(fn _ => isBalanced "{}[" |> Expect.falsy),
test "too many closing brackets"
(fn _ => isBalanced "[]]" |> Expect.falsy),
test "early unexpected brackets"
(fn _ => isBalanced ")()" |> Expect.falsy),
test "early mismatched brackets"
(fn _ => isBalanced "{)()" |> Expect.falsy),
test "math expression"
(fn _ => isBalanced "(((185 + 223.85) * 15) - 543)/2" |> Expect.truthy),
test "complex latex expression"
Expand Down