Skip to content

Commit 87c9c4a

Browse files
Merge pull request #455 from geonove/geonove/Fix-test-cases
Use REQUIRE_THROWS_WITH to check for error message
2 parents 711e24f + 0a6218c commit 87c9c4a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

count/test/count_min_test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ TEST_CASE("CM init") {
5555
TEST_CASE("CM parameter suggestions", "[error parameters]") {
5656

5757
// Bucket suggestions
58-
REQUIRE_THROWS(count_min_sketch<uint64_t>::suggest_num_buckets(-1.0), "Confidence must be between 0 and 1.0 (inclusive)." );
58+
REQUIRE_THROWS_WITH(count_min_sketch<uint64_t>::suggest_num_buckets(-1.0), "Relative error must be at least 0.");
5959
REQUIRE(count_min_sketch<uint64_t>::suggest_num_buckets(0.2) == 14);
6060
REQUIRE(count_min_sketch<uint64_t>::suggest_num_buckets(0.1) == 28);
6161
REQUIRE(count_min_sketch<uint64_t>::suggest_num_buckets(0.05) == 55);
@@ -69,8 +69,8 @@ TEST_CASE("CM parameter suggestions", "[error parameters]") {
6969
REQUIRE(count_min_sketch<uint64_t>(n_hashes, 272).get_relative_error() <= 0.01);
7070

7171
// Hash suggestions
72-
REQUIRE_THROWS(count_min_sketch<uint64_t>::suggest_num_hashes(10.0), "Confidence must be between 0 and 1.0 (inclusive)." );
73-
REQUIRE_THROWS(count_min_sketch<uint64_t>::suggest_num_hashes(-1.0), "Confidence must be between 0 and 1.0 (inclusive)." );
72+
REQUIRE_THROWS_WITH(count_min_sketch<uint64_t>::suggest_num_hashes(10.0), "Confidence must be between 0 and 1.0 (inclusive)." );
73+
REQUIRE_THROWS_WITH(count_min_sketch<uint64_t>::suggest_num_hashes(-1.0), "Confidence must be between 0 and 1.0 (inclusive)." );
7474
REQUIRE(count_min_sketch<uint64_t>::suggest_num_hashes(0.682689492) == 2); // 1 STDDEV
7575
REQUIRE(count_min_sketch<uint64_t>::suggest_num_hashes(0.954499736) == 4); // 2 STDDEV
7676
REQUIRE(count_min_sketch<uint64_t>::suggest_num_hashes(0.997300204) == 6); // 3 STDDEV
@@ -161,9 +161,9 @@ TEST_CASE("CM merge - reject", "[reject cases]") {
161161
std::vector<count_min_sketch<uint64_t>> sketches = {s1, s2, s3};
162162

163163
// Fail cases
164-
REQUIRE_THROWS(s.merge(s), "Cannot merge a sketch with itself." );
164+
REQUIRE_THROWS_WITH(s.merge(s), "Cannot merge a sketch with itself." );
165165
for (count_min_sketch<uint64_t> sk : sketches) {
166-
REQUIRE_THROWS(s.merge(sk), "Incompatible sketch config." );
166+
REQUIRE_THROWS_WITH(s.merge(sk), "Incompatible sketch configuration." );
167167
}
168168
}
169169

0 commit comments

Comments
 (0)