Skip to content

Commit 4e28ff3

Browse files
committed
Improved test [skip ci]
1 parent 9771322 commit 4e28ff3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

test/pqxx_test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <limits>
12
#include <optional>
23
#include <string>
34
#include <string_view>
@@ -324,6 +325,9 @@ void test_sparsevec_to_buf() {
324325
char buf[120];
325326
assert_equal(pqxx::to_buf(std::span<char>{buf}, pgvector::SparseVector{{1, 2, 3}}), "{1:1,2:2,3:3}/3");
326327

328+
int max = std::numeric_limits<int>::max();
329+
assert_equal(pqxx::to_buf(std::span<char>{buf}, pgvector::SparseVector{{{max - 1, 1}}, max}), "{2147483647:1}/2147483647");
330+
327331
assert_exception<pqxx::conversion_overrun>([] {
328332
return pqxx::to_buf(std::span<char>{}, pgvector::SparseVector{{1, 2, 3}});
329333
}, "Not enough space in buffer for sparsevec");

0 commit comments

Comments
 (0)