mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-16 01:26:56 +08:00
Added more minivec tests [skip ci]
This commit is contained in:
@@ -40,6 +40,10 @@ for (1 .. 50)
|
|||||||
$actual = $node->safe_psql("postgres", "SELECT halfvec_cmp(v::halfvec, '$query'::real[]::halfvec) FROM tst");
|
$actual = $node->safe_psql("postgres", "SELECT halfvec_cmp(v::halfvec, '$query'::real[]::halfvec) FROM tst");
|
||||||
is($expected, $actual);
|
is($expected, $actual);
|
||||||
|
|
||||||
|
# Test minivec
|
||||||
|
$actual = $node->safe_psql("postgres", "SELECT minivec_cmp(v::minivec, '$query'::real[]::minivec) FROM tst");
|
||||||
|
is($expected, $actual);
|
||||||
|
|
||||||
# Test sparsevec
|
# Test sparsevec
|
||||||
$actual = $node->safe_psql("postgres", "SELECT sparsevec_cmp(v::vector::sparsevec, '$query'::real[]::vector::sparsevec) FROM tst");
|
$actual = $node->safe_psql("postgres", "SELECT sparsevec_cmp(v::vector::sparsevec, '$query'::real[]::vector::sparsevec) FROM tst");
|
||||||
is($expected, $actual);
|
is($expected, $actual);
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ for my $function (@functions)
|
|||||||
my $actual = $node->safe_psql("postgres", "SELECT $function(v::halfvec, '$query'::vector::halfvec) FROM tst");
|
my $actual = $node->safe_psql("postgres", "SELECT $function(v::halfvec, '$query'::vector::halfvec) FROM tst");
|
||||||
is($expected, $actual, "halfvec $function");
|
is($expected, $actual, "halfvec $function");
|
||||||
|
|
||||||
|
# Test minivec
|
||||||
|
$actual = $node->safe_psql("postgres", "SELECT $function(v::minivec, '$query'::vector::minivec) FROM tst");
|
||||||
|
is($expected, $actual, "minivec $function");
|
||||||
|
|
||||||
# Test sparsevec
|
# Test sparsevec
|
||||||
$actual = $node->safe_psql("postgres", "SELECT $function(v::sparsevec, '$query'::vector::sparsevec) FROM tst");
|
$actual = $node->safe_psql("postgres", "SELECT $function(v::sparsevec, '$query'::vector::sparsevec) FROM tst");
|
||||||
is($expected, $actual, "sparsevec $function");
|
is($expected, $actual, "sparsevec $function");
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ $node->start;
|
|||||||
# Create extension
|
# Create extension
|
||||||
$node->safe_psql("postgres", "CREATE EXTENSION vector;");
|
$node->safe_psql("postgres", "CREATE EXTENSION vector;");
|
||||||
|
|
||||||
my @types = ("vector", "halfvec", "sparsevec");
|
my @types = ("vector", "halfvec", "minivec", "sparsevec");
|
||||||
my @inputs = ("[1.23,4.56,7.89]", "[1.23,4.56,7.89]", "{1:1.23,2:4.56,3:7.89}/3");
|
my @inputs = ("[1.23,4.56,7.89]", "[1.23,4.56,7.89]", "[1.23,4.56,7.89]", "{1:1.23,2:4.56,3:7.89}/3");
|
||||||
my @subs = (" ", " ", ",", ":", "-", "1", "9", "\0", "2147483648", "-2147483649");
|
my @subs = (" ", " ", ",", ":", "-", "1", "9", "\0", "2147483648", "-2147483649");
|
||||||
|
|
||||||
for my $i (0 .. $#types)
|
for my $i (0 .. $#types)
|
||||||
|
|||||||
Reference in New Issue
Block a user