Skip to content

Commit 98be8d4

Browse files
committed
Improved tests [skip ci]
1 parent 57afcf9 commit 98be8d4

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

test/pqxx_test.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#include "helper.hpp"
1010

11-
using namespace std::string_literals;
12-
1311
void setup(pqxx::connection &conn) {
1412
pqxx::nontransaction tx(conn);
1513
tx.exec("CREATE EXTENSION IF NOT EXISTS vector");
@@ -126,8 +124,8 @@ void test_stream_to(pqxx::connection &conn) {
126124
stream.write_values(pgvector::Vector({4, 5, 6}));
127125
stream.complete();
128126
pqxx::result res = tx.exec("SELECT embedding FROM items ORDER BY id");
129-
assert_equal(res[0][0].as<std::string>(), "[1,2,3]"s);
130-
assert_equal(res[1][0].as<std::string>(), "[4,5,6]"s);
127+
assert_equal(res[0][0].as<std::string>(), std::string("[1,2,3]"));
128+
assert_equal(res[1][0].as<std::string>(), std::string("[4,5,6]"));
131129
}
132130

133131
void test_precision(pqxx::connection &conn) {
@@ -142,8 +140,8 @@ void test_precision(pqxx::connection &conn) {
142140
}
143141

144142
void test_vector_to_string() {
145-
assert_equal(pqxx::to_string(pgvector::Vector({1, 2, 3})), "[1,2,3]"s);
146-
assert_equal(pqxx::to_string(pgvector::Vector({-1.234567890123})), "[-1.2345679]"s);
143+
assert_equal(pqxx::to_string(pgvector::Vector({1, 2, 3})), std::string("[1,2,3]"));
144+
assert_equal(pqxx::to_string(pgvector::Vector({-1.234567890123})), std::string("[-1.2345679]"));
147145

148146
assert_exception<pqxx::conversion_overrun>([] {
149147
auto unused = pqxx::to_string(pgvector::Vector(std::vector<float>(16001)));
@@ -180,8 +178,8 @@ void test_vector_from_string() {
180178
}
181179

182180
void test_halfvec_to_string() {
183-
assert_equal(pqxx::to_string(pgvector::HalfVector({1, 2, 3})), "[1,2,3]"s);
184-
assert_equal(pqxx::to_string(pgvector::HalfVector({-1.234567890123})), "[-1.2345679]"s);
181+
assert_equal(pqxx::to_string(pgvector::HalfVector({1, 2, 3})), std::string("[1,2,3]"));
182+
assert_equal(pqxx::to_string(pgvector::HalfVector({-1.234567890123})), std::string("[-1.2345679]"));
185183

186184
assert_exception<pqxx::conversion_overrun>([] {
187185
auto unused = pqxx::to_string(pgvector::HalfVector(std::vector<float>(16001)));
@@ -218,9 +216,9 @@ void test_halfvec_from_string() {
218216
}
219217

220218
void test_sparsevec_to_string() {
221-
assert_equal(pqxx::to_string(pgvector::SparseVector({1, 0, 2, 0, 3, 0})), "{1:1,3:2,5:3}/6"s);
219+
assert_equal(pqxx::to_string(pgvector::SparseVector({1, 0, 2, 0, 3, 0})), std::string("{1:1,3:2,5:3}/6"));
222220
std::unordered_map<int, float> map = {{999999999, -1.234567890123}};
223-
assert_equal(pqxx::to_string(pgvector::SparseVector(map, 1000000000)), "{1000000000:-1.2345679}/1000000000"s);
221+
assert_equal(pqxx::to_string(pgvector::SparseVector(map, 1000000000)), std::string("{1000000000:-1.2345679}/1000000000"));
224222
}
225223

226224
void test_sparsevec_from_string() {

0 commit comments

Comments
 (0)