From 714dcbb0285c185e15569a9175dab11b7fc44f28 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Tue, 19 Dec 2023 18:58:10 +1100 Subject: [PATCH] Sync matching-brackets exercise --- exercises/practice/matching-brackets/.meta/tests.toml | 9 +++++++++ exercises/practice/matching-brackets/test.sml | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/exercises/practice/matching-brackets/.meta/tests.toml b/exercises/practice/matching-brackets/.meta/tests.toml index 65b5562..35a98a0 100644 --- a/exercises/practice/matching-brackets/.meta/tests.toml +++ b/exercises/practice/matching-brackets/.meta/tests.toml @@ -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" diff --git a/exercises/practice/matching-brackets/test.sml b/exercises/practice/matching-brackets/test.sml index 6f5d601..017f03d 100644 --- a/exercises/practice/matching-brackets/test.sml +++ b/exercises/practice/matching-brackets/test.sml @@ -1,4 +1,4 @@ -(* version 1.4.0 *) +(* version 1.5.0 *) use "testlib.sml"; use "matching-brackets.sml"; @@ -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"