Skip to content

Commit aaf6241

Browse files
committed
Improved tests [skip ci]
1 parent 2aa26cc commit aaf6241

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

test/pqxx_test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void test_vector_to_string() {
144144
assert_equal(pqxx::to_string(pgvector::Vector({-1.234567890123})), "[-1.2345679]");
145145

146146
assert_exception<pqxx::conversion_overrun>([] {
147-
auto unused = pqxx::to_string(pgvector::Vector(std::vector<float>(16001)));
147+
pqxx::to_string(pgvector::Vector(std::vector<float>(16001)));
148148
}, "vector cannot have more than 16000 dimensions");
149149
}
150150

@@ -182,7 +182,7 @@ void test_halfvec_to_string() {
182182
assert_equal(pqxx::to_string(pgvector::HalfVector({-1.234567890123})), "[-1.2345679]");
183183

184184
assert_exception<pqxx::conversion_overrun>([] {
185-
auto unused = pqxx::to_string(pgvector::HalfVector(std::vector<float>(16001)));
185+
pqxx::to_string(pgvector::HalfVector(std::vector<float>(16001)));
186186
}, "halfvec cannot have more than 16000 dimensions");
187187
}
188188

@@ -219,6 +219,10 @@ void test_sparsevec_to_string() {
219219
assert_equal(pqxx::to_string(pgvector::SparseVector({1, 0, 2, 0, 3, 0})), "{1:1,3:2,5:3}/6");
220220
std::unordered_map<int, float> map = {{999999999, -1.234567890123}};
221221
assert_equal(pqxx::to_string(pgvector::SparseVector(map, 1000000000)), "{1000000000:-1.2345679}/1000000000");
222+
223+
assert_exception<pqxx::conversion_overrun>([] {
224+
pqxx::to_string(pgvector::SparseVector(std::vector<float>(16001, 1)));
225+
}, "sparsevec cannot have more than 16000 dimensions");
222226
}
223227

224228
void test_sparsevec_from_string() {
@@ -272,10 +276,6 @@ void test_sparsevec_from_string() {
272276
assert_exception<pqxx::conversion_error>([] {
273277
auto unused = pqxx::from_string<pgvector::SparseVector>("{}/a");
274278
}, "Could not convert 'a' to int: Invalid argument.");
275-
276-
assert_exception<pqxx::conversion_overrun>([] {
277-
auto unused = pqxx::to_string(pgvector::SparseVector(std::vector<float>(16001, 1)));
278-
}, "sparsevec cannot have more than 16000 dimensions");
279279
}
280280

281281
void test_pqxx() {

test/sparsevec_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ static void test_constructor_map() {
2727
assert_equal(vec.values() == std::vector<float>{1, 2, 3}, true);
2828

2929
assert_exception<std::invalid_argument>([&]{
30-
auto unused = SparseVector(map, 0);
30+
SparseVector(map, 0);
3131
}, "sparsevec must have at least 1 dimension");
3232

3333
assert_exception<std::invalid_argument>([&]{
34-
auto unused = SparseVector(map, 4);
34+
SparseVector(map, 4);
3535
}, "sparsevec index out of bounds");
3636
}
3737

0 commit comments

Comments
 (0)