Skip to content

Commit

Permalink
Added tests for bracket matcher to include different types of brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
thk123 committed Oct 26, 2017
1 parent 3beab8b commit f892f4a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions unit/java_bytecode/java_utils_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,41 @@ SCENARIO("Test that the generic signature delimiter lookup works reliably",
REQUIRE(find_closing_delimiter(generic_sigs[6], 9, '<', '>')==17);
}
}
GIVEN("Some bracketed functions")
{
std::vector<std::string> bracket_sigs{
// Valid inputs
"(Entry)",
"Something(Else)",
"(Nested(Bracket))",
// Invalid inputs
"(",
"(Integer>",
};
WHEN("We check if the closing tag is recognised correctly")
{
// TEST VALID CASES

// (Entry)
REQUIRE(find_closing_delimiter(bracket_sigs[0], 0, '(', ')') == 6);
// Something(Else)
REQUIRE(find_closing_delimiter(bracket_sigs[1], 9, '(', ')') == 14);
// (Nested(Bracket))
REQUIRE(find_closing_delimiter(bracket_sigs[2], 0, '(', ')') == 16);
REQUIRE(find_closing_delimiter(bracket_sigs[2], 7, '(', ')') == 15);

// TEST INVALID CASES

// (
REQUIRE(
find_closing_delimiter(bracket_sigs[3], 0, '(', ')') ==
std::string::npos);
// (Integer>
REQUIRE(
find_closing_delimiter(bracket_sigs[4], 0, '(', ')') ==
std::string::npos);
}
}
}

SCENARIO("gather_full_class_name")
Expand Down

0 comments on commit f892f4a

Please sign in to comment.