From 6e1e3c013e070098f020494b4a6609ad2712e187 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Fri, 17 Jan 2025 17:42:32 +0530 Subject: [PATCH] Updating tests for matching-brackets --- .../matching-brackets/.meta/config.json | 1 + .../matching-brackets/.meta/tests.toml | 22 ++++++++++++++++--- .../matching-brackets.spec.js | 12 ++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/exercises/practice/matching-brackets/.meta/config.json b/exercises/practice/matching-brackets/.meta/config.json index ab05e019d8..c355f03bf0 100644 --- a/exercises/practice/matching-brackets/.meta/config.json +++ b/exercises/practice/matching-brackets/.meta/config.json @@ -5,6 +5,7 @@ "contributors": [ "ankorGH", "Futuro212", + "jagdish-15", "ovidiu141", "rchavarria", "ryanplusplus", diff --git a/exercises/practice/matching-brackets/.meta/tests.toml b/exercises/practice/matching-brackets/.meta/tests.toml index cc9e471a42..35a98a0421 100644 --- a/exercises/practice/matching-brackets/.meta/tests.toml +++ b/exercises/practice/matching-brackets/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [81ec11da-38dd-442a-bcf9-3de7754609a5] description = "paired square brackets" @@ -41,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/matching-brackets.spec.js b/exercises/practice/matching-brackets/matching-brackets.spec.js index ccd6b4a826..2f08561b28 100644 --- a/exercises/practice/matching-brackets/matching-brackets.spec.js +++ b/exercises/practice/matching-brackets/matching-brackets.spec.js @@ -54,6 +54,10 @@ describe('Matching Brackets', () => { expect(isPaired('[({]})')).toEqual(false); }); + xtest('paired and wrong nested brackets but innermost are correct', () => { + expect(isPaired('[({}])')).toEqual(false); + }); + xtest('paired and incomplete brackets', () => { expect(isPaired('{}[')).toEqual(false); }); @@ -62,6 +66,14 @@ describe('Matching Brackets', () => { expect(isPaired('[]]')).toEqual(false); }); + xtest('early unexpected brackets', () => { + expect(isPaired(')()')).toEqual(false); + }); + + xtest('early mismatched brackets', () => { + expect(isPaired('{)()')).toEqual(false); + }); + xtest('math expression', () => { expect(isPaired('(((185 + 223.85) * 15) - 543)/2')).toEqual(true); });