Skip to content

Commit f381498

Browse files
committed
Refactor catch2 vector matchers to syntax required by newer version.
1 parent c51d7e1 commit f381498

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_invoke_dynamic.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,15 @@ void validate_lambda_assignment(
9494
REQUIRE_THAT(
9595
parents,
9696
// NOLINTNEXTLINE(whitespace/braces)
97-
Catch::Matchers::Vector::ContainsElementMatcher<irep_idt>{
98-
test_data.lambda_interface});
97+
Catch::Matchers::VectorContains(test_data.lambda_interface));
9998

10099
const auto &interface_children =
101100
class_hierarchy.get_children_trans(test_data.lambda_interface);
102101

103102
REQUIRE_THAT(
104103
interface_children,
105104
// NOLINTNEXTLINE(whitespace/braces)
106-
Catch::Matchers::Vector::ContainsElementMatcher<irep_idt>{
107-
tmp_class_identifier});
105+
Catch::Matchers::VectorContains(tmp_class_identifier));
108106

109107
THEN("The function in the class should call the lambda method")
110108
{
@@ -145,7 +143,7 @@ void validate_lambda_assignment(
145143

146144
REQUIRE_THAT(
147145
function_call.arguments(),
148-
Catch::Matchers::Vector::EqualsMatcher<exprt>{expected_args});
146+
Catch::Matchers::Equals(std::vector<exprt>(expected_args)));
149147

150148
if(test_data.should_return_value)
151149
{

unit/testing-utils/require_vectors_equal_unordered.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void require_vectors_equal_unordered(
2222
const std::vector<T> &expected)
2323
{
2424
REQUIRE(actual.size() == expected.size());
25-
REQUIRE_THAT(actual, Catch::Matchers::Vector::ContainsMatcher<T>{expected});
25+
REQUIRE_THAT(actual, Catch::Matchers::UnorderedEquals(expected));
2626
}
2727

2828
#endif // CPROVER_TESTING_UTILS_REQUIRE_VECTORS_EQUAL_UNORDERED_H

unit/util/string_utils/split_string.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ void run_on_all_variants(
4242
REQUIRE_THAT(
4343
result,
4444
// NOLINTNEXTLINE(whitespace/braces)
45-
Catch::Matchers::Vector::EqualsMatcher<std::string>{
46-
expected_results.no_strip_no_remove});
45+
Catch::Matchers::Equals(
46+
std::vector<std::string>(expected_results.no_strip_no_remove)));
4747
}
4848
}
4949
WHEN("Not stripping, removing empty")
@@ -56,8 +56,8 @@ void run_on_all_variants(
5656
REQUIRE_THAT(
5757
result,
5858
// NOLINTNEXTLINE(whitespace/braces)
59-
Catch::Matchers::Vector::EqualsMatcher<std::string>{
60-
expected_results.no_strip_remove_empty});
59+
Catch::Matchers::Equals(
60+
std::vector<std::string>(expected_results.no_strip_remove_empty)));
6161
}
6262
}
6363
WHEN("Stripping, not removing empty")
@@ -70,8 +70,8 @@ void run_on_all_variants(
7070
REQUIRE_THAT(
7171
result,
7272
// NOLINTNEXTLINE(whitespace/braces)
73-
Catch::Matchers::Vector::EqualsMatcher<std::string>{
74-
expected_results.strip_no_remove});
73+
Catch::Matchers::Equals(
74+
std::vector<std::string>(expected_results.strip_no_remove)));
7575
}
7676
}
7777
WHEN("Stripping and removing empty")
@@ -84,8 +84,8 @@ void run_on_all_variants(
8484
REQUIRE_THAT(
8585
result,
8686
// NOLINTNEXTLINE(whitespace/braces)
87-
Catch::Matchers::Vector::EqualsMatcher<std::string>{
88-
expected_results.strip_remove_empty});
87+
Catch::Matchers::Equals(
88+
std::vector<std::string>(expected_results.strip_remove_empty)));
8989
}
9090
}
9191
}
@@ -146,9 +146,7 @@ SCENARIO("split_string", "[core][utils][string_utils][split_string]")
146146
THEN("Should get expected vector")
147147
{
148148
std::vector<std::string> expected_result = {"a", "b", "c"};
149-
REQUIRE_THAT(
150-
result,
151-
Catch::Matchers::Vector::EqualsMatcher<std::string>{expected_result});
149+
REQUIRE_THAT(result, Catch::Matchers::Equals(expected_result));
152150
}
153151
}
154152
WHEN("Not stripping, removing empty")
@@ -159,9 +157,7 @@ SCENARIO("split_string", "[core][utils][string_utils][split_string]")
159157
THEN("Should get expected vector")
160158
{
161159
std::vector<std::string> expected_result = {"a", "b", "c"};
162-
REQUIRE_THAT(
163-
result,
164-
Catch::Matchers::Vector::EqualsMatcher<std::string>{expected_result});
160+
REQUIRE_THAT(result, Catch::Matchers::Equals(expected_result));
165161
}
166162
}
167163
// TODO(tkiley): here we should check what happens when trying to enable

0 commit comments

Comments
 (0)