From 9925b92d7330ba92812a2761240e92b9ef122942 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 23 Sep 2024 18:29:17 -0700 Subject: [PATCH] Added more minivec tests [skip ci] --- test/t/033_comparison.pl | 4 ++++ test/t/034_distance_functions.pl | 4 ++++ test/t/037_inputs.pl | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/t/033_comparison.pl b/test/t/033_comparison.pl index b668748..f027224 100644 --- a/test/t/033_comparison.pl +++ b/test/t/033_comparison.pl @@ -40,6 +40,10 @@ for (1 .. 50) $actual = $node->safe_psql("postgres", "SELECT halfvec_cmp(v::halfvec, '$query'::real[]::halfvec) FROM tst"); 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 $actual = $node->safe_psql("postgres", "SELECT sparsevec_cmp(v::vector::sparsevec, '$query'::real[]::vector::sparsevec) FROM tst"); is($expected, $actual); diff --git a/test/t/034_distance_functions.pl b/test/t/034_distance_functions.pl index 180fa46..d64b8dc 100644 --- a/test/t/034_distance_functions.pl +++ b/test/t/034_distance_functions.pl @@ -45,6 +45,10 @@ for my $function (@functions) my $actual = $node->safe_psql("postgres", "SELECT $function(v::halfvec, '$query'::vector::halfvec) FROM tst"); 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 $actual = $node->safe_psql("postgres", "SELECT $function(v::sparsevec, '$query'::vector::sparsevec) FROM tst"); is($expected, $actual, "sparsevec $function"); diff --git a/test/t/037_inputs.pl b/test/t/037_inputs.pl index bf4cc20..2290b2e 100644 --- a/test/t/037_inputs.pl +++ b/test/t/037_inputs.pl @@ -12,8 +12,8 @@ $node->start; # Create extension $node->safe_psql("postgres", "CREATE EXTENSION vector;"); -my @types = ("vector", "halfvec", "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 @types = ("vector", "halfvec", "minivec", "sparsevec"); +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"); for my $i (0 .. $#types)