You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto unused = pqxx::from_string<pgvector::SparseVector>("{0:1}/1");
271
-
assert(false);
272
-
} catch (const pqxx::conversion_error& e) {
273
-
assert(std::string_view(e.what()) == "Index out of bounds");
274
-
}
237
+
}, "Index out of bounds");
275
238
276
-
try {
239
+
assert_exception<pqxx::conversion_error>([] {
277
240
auto unused = pqxx::from_string<pgvector::SparseVector>("{-2147483648:1}/1");
278
-
assert(false);
279
-
} catch (const pqxx::conversion_error& e) {
280
-
assert(std::string_view(e.what()) == "Index out of bounds");
281
-
}
241
+
}, "Index out of bounds");
282
242
283
-
try {
243
+
assert_exception<pqxx::conversion_error>([] {
284
244
auto unused = pqxx::from_string<pgvector::SparseVector>("{1:4e38}/1");
285
-
assert(false);
286
-
} catch (const pqxx::conversion_error& e) {
287
-
assert(std::string_view(e.what()) == "Could not convert string to numeric value: '4e38'." || std::string_view(e.what()) == "Could not convert '4e38' to float" || std::string_view(e.what()) == "Could not convert '4e38' to float: Value out of range.");
288
-
}
245
+
});
289
246
290
-
try {
247
+
assert_exception<pqxx::conversion_error>([] {
291
248
auto unused = pqxx::from_string<pgvector::SparseVector>("{a:1}/1");
292
-
assert(false);
293
-
} catch (const pqxx::conversion_error& e) {
294
-
assert(std::string_view(e.what()) == "Could not convert 'a' to int: Invalid argument.");
295
-
}
249
+
}, "Could not convert 'a' to int: Invalid argument.");
296
250
297
-
try {
251
+
assert_exception<pqxx::conversion_error>([] {
298
252
auto unused = pqxx::from_string<pgvector::SparseVector>("{1:a}/1");
299
-
assert(false);
300
-
} catch (const pqxx::conversion_error& e) {
301
-
assert(std::string_view(e.what()) == "Could not convert string to numeric value: 'a'." || std::string_view(e.what()) == "Could not convert 'a' to float" || std::string_view(e.what()) == "Could not convert 'a' to float: Invalid argument.");
302
-
}
253
+
});
303
254
304
-
try {
255
+
assert_exception<pqxx::conversion_error>([] {
305
256
auto unused = pqxx::from_string<pgvector::SparseVector>("{}/a");
306
-
assert(false);
307
-
} catch (const pqxx::conversion_error& e) {
308
-
assert(std::string_view(e.what()) == "Could not convert 'a' to int: Invalid argument.");
309
-
}
257
+
}, "Could not convert 'a' to int: Invalid argument.");
310
258
311
-
try {
259
+
assert_exception<pqxx::conversion_overrun>([] {
312
260
auto unused = pqxx::to_string(pgvector::SparseVector(std::vector<float>(16001, 1)));
313
-
assert(false);
314
-
} catch (const pqxx::conversion_overrun& e) {
315
-
assert(std::string_view(e.what()) == "sparsevec cannot have more than 16000 dimensions");
316
-
}
261
+
}, "sparsevec cannot have more than 16000 dimensions");
0 commit comments