Skip to content

Commit 2b0842f

Browse files
committed
Fixed clang-tidy warnings [skip ci]
1 parent 4fe2b45 commit 2b0842f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/pqxx_test.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void test_sparsevec_from_string() {
305305
}
306306

307307
void test_vector_to_buf() {
308-
char buf[60];
308+
std::array<char, 60> buf{};
309309
assert_equal(pqxx::to_buf(std::span<char>{buf}, pgvector::Vector{{1, 2, 3}}), "[1,2,3]");
310310

311311
assert_exception<pqxx::conversion_overrun>([] {
@@ -314,18 +314,18 @@ void test_vector_to_buf() {
314314
}
315315

316316
void test_vector_into_buf() {
317-
char buf[60];
317+
std::array<char, 60> buf{};
318318
size_t size = pqxx::into_buf(std::span<char>{buf}, pgvector::Vector{{1, 2, 3}});
319319
assert_equal(size, 7u);
320-
assert_equal(std::string_view{buf, size}, "[1,2,3]");
320+
assert_equal(std::string_view{buf.data(), size}, "[1,2,3]");
321321

322322
assert_exception<pqxx::conversion_overrun>([] {
323323
return pqxx::into_buf(std::span<char>{}, pgvector::Vector{{1, 2, 3}});
324324
}, "Not enough space in buffer for vector");
325325
}
326326

327327
void test_halfvec_to_buf() {
328-
char buf[60];
328+
std::array<char, 60> buf{};
329329
assert_equal(pqxx::to_buf(std::span<char>{buf}, pgvector::HalfVector{{1, 2, 3}}), "[1,2,3]");
330330

331331
assert_exception<pqxx::conversion_overrun>([] {
@@ -334,18 +334,18 @@ void test_halfvec_to_buf() {
334334
}
335335

336336
void test_halfvec_into_buf() {
337-
char buf[60];
337+
std::array<char, 60> buf{};
338338
size_t size = pqxx::into_buf(std::span<char>{buf}, pgvector::HalfVector{{1, 2, 3}});
339339
assert_equal(size, 7u);
340-
assert_equal(std::string_view{buf, size}, "[1,2,3]");
340+
assert_equal(std::string_view{buf.data(), size}, "[1,2,3]");
341341

342342
assert_exception<pqxx::conversion_overrun>([] {
343343
return pqxx::into_buf(std::span<char>{}, pgvector::HalfVector{{1, 2, 3}});
344344
}, "Not enough space in buffer for halfvec");
345345
}
346346

347347
void test_sparsevec_to_buf() {
348-
char buf[120];
348+
std::array<char, 120> buf{};
349349
assert_equal(pqxx::to_buf(std::span<char>{buf}, pgvector::SparseVector{{1, 2, 3}}), "{1:1,2:2,3:3}/3");
350350

351351
int max = std::numeric_limits<int>::max();
@@ -357,10 +357,10 @@ void test_sparsevec_to_buf() {
357357
}
358358

359359
void test_sparsevec_into_buf() {
360-
char buf[120];
360+
std::array<char, 120> buf{};
361361
size_t size = pqxx::into_buf(std::span<char>{buf}, pgvector::SparseVector{{1, 2, 3}});
362362
assert_equal(size, 15u);
363-
assert_equal(std::string_view{buf, size}, "{1:1,2:2,3:3}/3");
363+
assert_equal(std::string_view{buf.data(), size}, "{1:1,2:2,3:3}/3");
364364

365365
assert_exception<pqxx::conversion_overrun>([] {
366366
return pqxx::into_buf(std::span<char>{}, pgvector::SparseVector{{1, 2, 3}});

0 commit comments

Comments
 (0)