Skip to content

Commit 2b4f0ae

Browse files
committed
Use REQUIRE_THROWS_AS() in sharing map unit tests
1 parent 2d29291 commit 2b4f0ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

unit/util/sharing_map.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ TEST_CASE("Sharing map interface", "[core][util]")
159159

160160
cbmc_invariants_should_throwt invariants_throw;
161161

162-
REQUIRE_THROWS(sm.insert("i", "4"));
162+
REQUIRE_THROWS_AS(sm.insert("i", "4"), invariant_failedt);
163163
}
164164

165165
SECTION("Replace and update elements")
@@ -190,22 +190,24 @@ TEST_CASE("Sharing map interface", "[core][util]")
190190

191191
SECTION("Replace non-existing")
192192
{
193-
REQUIRE_THROWS(sm.replace("x", "0"));
193+
REQUIRE_THROWS_AS(sm.replace("x", "0"), invariant_failedt);
194194
}
195195

196196
SECTION("Update non-existing")
197197
{
198-
REQUIRE_THROWS(sm.update("x", [](std::string &str) {}));
198+
REQUIRE_THROWS_AS(
199+
sm.update("x", [](std::string &str) {}), invariant_failedt);
199200
}
200201

201202
SECTION("Replace with equal")
202203
{
203-
REQUIRE_THROWS(debug_sm.replace("i", "0"));
204+
REQUIRE_THROWS_AS(debug_sm.replace("i", "0"), invariant_failedt);
204205
}
205206

206207
SECTION("Update with equal")
207208
{
208-
REQUIRE_THROWS(debug_sm.update("i", [](std::string &str) {}));
209+
REQUIRE_THROWS_AS(
210+
debug_sm.update("i", [](std::string &str) {}), invariant_failedt);
209211
}
210212
}
211213

@@ -272,7 +274,7 @@ TEST_CASE("Sharing map interface", "[core][util]")
272274

273275
cbmc_invariants_should_throwt invariants_throw;
274276

275-
REQUIRE_THROWS(sm3.erase("x"));
277+
REQUIRE_THROWS_AS(sm3.erase("x"), invariant_failedt);
276278
}
277279
}
278280

0 commit comments

Comments
 (0)