@@ -156,6 +156,7 @@ void test_precision(pqxx::connection &conn) {
156156
157157void test_vector_to_string () {
158158 assert (pqxx::to_string (pgvector::Vector ({1 , 2 , 3 })) == " [1,2,3]" );
159+ assert (pqxx::to_string (pgvector::Vector ({1.234567890123 })) == " [1.2345679]" );
159160
160161 assert_exception<pqxx::conversion_overrun>([] {
161162 auto unused = pqxx::to_string (pgvector::Vector (std::vector<float >(16001 )));
@@ -193,6 +194,7 @@ void test_vector_from_string() {
193194
194195void test_halfvec_to_string () {
195196 assert (pqxx::to_string (pgvector::HalfVector ({1 , 2 , 3 })) == " [1,2,3]" );
197+ assert (pqxx::to_string (pgvector::HalfVector ({1.234567890123 })) == " [1.2345679]" );
196198
197199 assert_exception<pqxx::conversion_overrun>([] {
198200 auto unused = pqxx::to_string (pgvector::HalfVector (std::vector<float >(16001 )));
@@ -230,6 +232,8 @@ void test_halfvec_from_string() {
230232
231233void test_sparsevec_to_string () {
232234 assert (pqxx::to_string (pgvector::SparseVector ({1 , 0 , 2 , 0 , 3 , 0 })) == " {1:1,3:2,5:3}/6" );
235+ std::unordered_map<int , float > map = {{999999999 , 1.234567890123 }};
236+ assert (pqxx::to_string (pgvector::SparseVector (map, 1000000000 )) == " {1000000000:1.2345679}/1000000000" );
233237}
234238
235239void test_sparsevec_from_string () {
0 commit comments