Skip to content

Commit 1c76ec5

Browse files
committed
Added test for span
1 parent 1f7e13e commit 1c76ec5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/main.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
#include "../include/pgvector/sparsevec.hpp"
66
#include "../include/pgvector/vector.hpp"
77

8+
#if __cplusplus >= 202002L
9+
#include <span>
10+
#endif
11+
812
using pgvector::HalfVector;
913
using pgvector::SparseVector;
1014
using pgvector::Vector;
@@ -16,6 +20,13 @@ void test_vector() {
1620
assert(vec.dimensions() == 3);
1721
}
1822

23+
#if __cplusplus >= 202002L
24+
void test_vector_span() {
25+
auto vec = Vector(std::span<const float>({1, 2, 3}));
26+
assert(vec.dimensions() == 3);
27+
}
28+
#endif
29+
1930
void test_halfvec() {
2031
auto vec = HalfVector({1, 2, 3});
2132
assert(vec.dimensions() == 3);
@@ -39,6 +50,9 @@ void test_sparsevec_map() {
3950
int main() {
4051
test_pqxx();
4152
test_vector();
53+
#if __cplusplus >= 202002L
54+
test_vector_span();
55+
#endif
4256
test_halfvec();
4357
test_sparsevec();
4458
return 0;

0 commit comments

Comments
 (0)