Skip to content

Commit

Permalink
Updating tests for matching-brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdish-15 committed Jan 17, 2025
1 parent 6c97691 commit 6e1e3c0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions exercises/practice/matching-brackets/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"contributors": [
"ankorGH",
"Futuro212",
"jagdish-15",
"ovidiu141",
"rchavarria",
"ryanplusplus",
Expand Down
22 changes: 19 additions & 3 deletions exercises/practice/matching-brackets/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"

Expand Down
12 changes: 12 additions & 0 deletions exercises/practice/matching-brackets/matching-brackets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down

0 comments on commit 6e1e3c0

Please sign in to comment.