Skip to content

Commit d126427

Browse files
IsaacGvaeng
andauthored
Sync tests for exercise/practice/matching_brackets (#959)
* Sync tests for exercise/practice/matching_brackets * add uids and missing test cases --------- Co-authored-by: vaeng <[email protected]>
1 parent 2e4ccc1 commit d126427

File tree

2 files changed

+75
-17
lines changed

2 files changed

+75
-17
lines changed

exercises/practice/matching-brackets/.meta/tests.toml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[81ec11da-38dd-442a-bcf9-3de7754609a5]
613
description = "paired square brackets"
@@ -41,12 +48,21 @@ description = "unpaired and nested brackets"
4148
[a0205e34-c2ac-49e6-a88a-899508d7d68e]
4249
description = "paired and wrong nested brackets"
4350

51+
[1d5c093f-fc84-41fb-8c2a-e052f9581602]
52+
description = "paired and wrong nested brackets but innermost are correct"
53+
4454
[ef47c21b-bcfd-4998-844c-7ad5daad90a8]
4555
description = "paired and incomplete brackets"
4656

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

60+
[a345a753-d889-4b7e-99ae-34ac85910d1a]
61+
description = "early unexpected brackets"
62+
63+
[21f81d61-1608-465a-b850-baa44c5def83]
64+
description = "early mismatched brackets"
65+
5066
[99255f93-261b-4435-a352-02bdecc9bdf2]
5167
description = "math expression"
5268

exercises/practice/matching-brackets/matching_brackets_test.cpp

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,94 @@
55
#include "test/catch.hpp"
66
#endif
77

8-
TEST_CASE("paired_square_brackets") { REQUIRE(matching_brackets::check("[]")); }
8+
TEST_CASE("paired_square_brackets", "[81ec11da-38dd-442a-bcf9-3de7754609a5]") {
9+
REQUIRE(matching_brackets::check("[]"));
10+
}
911

1012
#if defined(EXERCISM_RUN_ALL_TESTS)
11-
TEST_CASE("empty_string") { REQUIRE(matching_brackets::check("")); }
13+
TEST_CASE("empty_string", "[287f0167-ac60-4b64-8452-a0aa8f4e5238]") {
14+
REQUIRE(matching_brackets::check(""));
15+
}
1216

13-
TEST_CASE("unpaired_brackets") { REQUIRE(!matching_brackets::check("[[")); }
17+
TEST_CASE("unpaired_brackets", "[6c3615a3-df01-4130-a731-8ef5f5d78dac]") {
18+
REQUIRE(!matching_brackets::check("[["));
19+
}
1420

15-
TEST_CASE("wrong_ordered_brackets") {
21+
TEST_CASE("wrong_ordered_brackets", "[9d414171-9b98-4cac-a4e5-941039a97a77]") {
1622
REQUIRE(!matching_brackets::check("}{"));
1723
}
1824

19-
TEST_CASE("wrong_closing_bracket") { REQUIRE(!matching_brackets::check("{]")); }
25+
TEST_CASE("wrong_closing_bracket", "[f0f97c94-a149-4736-bc61-f2c5148ffb85]") {
26+
REQUIRE(!matching_brackets::check("{]"));
27+
}
2028

21-
TEST_CASE("paired_with_whitespace") {
29+
TEST_CASE("paired_with_whitespace", "[754468e0-4696-4582-a30e-534d47d69756]") {
2230
REQUIRE(matching_brackets::check("{ }"));
2331
}
2432

25-
TEST_CASE("simple_nested_brackets") {
33+
TEST_CASE("partially_paired_brackets",
34+
"[ba84f6ee-8164-434a-9c3e-b02c7f8e8545]") {
35+
REQUIRE(!matching_brackets::check("{[])"));
36+
}
37+
38+
TEST_CASE("simple_nested_brackets", "[3c86c897-5ff3-4a2b-ad9b-47ac3a30651d]") {
2639
REQUIRE(matching_brackets::check("{[]}"));
2740
}
2841

29-
TEST_CASE("several_paired_brackets") {
42+
TEST_CASE("several_paired_brackets", "[2d137f2c-a19e-4993-9830-83967a2d4726]") {
3043
REQUIRE(matching_brackets::check("{}[]"));
3144
}
3245

33-
TEST_CASE("paired_nested_brackets") {
46+
TEST_CASE("paired_nested_brackets", "[2e1f7b56-c137-4c92-9781-958638885a44]") {
3447
REQUIRE(matching_brackets::check("([{}({}[])])"));
3548
}
3649

37-
TEST_CASE("unopened_closing_brackets") {
50+
TEST_CASE("unopened_closing_brackets",
51+
"[84f6233b-e0f7-4077-8966-8085d295c19b]") {
3852
REQUIRE(!matching_brackets::check("{[)][]}"));
3953
}
4054

41-
TEST_CASE("unpaired_nested_brackets") {
55+
TEST_CASE("unpaired_nested_brackets",
56+
"[9b18c67d-7595-4982-b2c5-4cb949745d49]") {
4257
REQUIRE(!matching_brackets::check("([{])"));
4358
}
4459

45-
TEST_CASE("paired_wrong_nested_brackets") {
60+
TEST_CASE("paired_wrong_nested_brackets",
61+
"[a0205e34-c2ac-49e6-a88a-899508d7d68e]") {
4662
REQUIRE(!matching_brackets::check("[({]})"));
4763
}
4864

49-
TEST_CASE("math_expression") {
65+
TEST_CASE("paired_and_wrong_nested_brackets_but_innermost_are_correct",
66+
"[1d5c093f-fc84-41fb-8c2a-e052f9581602]") {
67+
REQUIRE(!matching_brackets::check("[({}])"));
68+
}
69+
70+
TEST_CASE("paired_incomplete_brackets",
71+
"[ef47c21b-bcfd-4998-844c-7ad5daad90a8]") {
72+
REQUIRE(!matching_brackets::check("{}["));
73+
}
74+
75+
TEST_CASE("too_many_closing_brackets",
76+
"[a4675a40-a8be-4fc2-bc47-2a282ce6edbe]") {
77+
REQUIRE(!matching_brackets::check("[]]"));
78+
}
79+
80+
TEST_CASE("early_unexpected_brackets",
81+
"[a345a753-d889-4b7e-99ae-34ac85910d1a]") {
82+
REQUIRE(!matching_brackets::check(")()"));
83+
}
84+
85+
TEST_CASE("early_mismatched_brackets",
86+
"[21f81d61-1608-465a-b850-baa44c5def83]") {
87+
REQUIRE(!matching_brackets::check("{)()"));
88+
}
89+
90+
TEST_CASE("math_expression", "[99255f93-261b-4435-a352-02bdecc9bdf2]") {
5091
REQUIRE(matching_brackets::check("(((185 + 223.85) * 15) - 543)/2"));
5192
}
5293

53-
TEST_CASE("complex_latex_expression") {
94+
TEST_CASE("complex_latex_expression",
95+
"[8e357d79-f302-469a-8515-2561877256a1]") {
5496
REQUIRE(matching_brackets::check(
5597
"\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... "
5698
"x^2 \\end{array}\\right)"));

0 commit comments

Comments
 (0)