Explicitly test that SQLite version 3.31.1 is compatible with sqlite-vec when statically compiling

This commit is contained in:
Alex Garcia 2024-08-05 16:46:35 -07:00
parent 2a8593a755
commit 530a3c95d2
5 changed files with 86 additions and 10 deletions

1
tests/minimum/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
dist/

26
tests/minimum/Makefile Normal file
View file

@ -0,0 +1,26 @@
#curl -q -o sqlite-amalgamation-3310100.zip https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip
#unzip https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip
dist/:
mkdir -p dist
touch $@
dist/sqlite-amalgamation-3310100: dist/
rm -rf sqlite-amalgamation-3310100/ || true
curl -q -o sqlite-amalgamation-3310100.zip https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip
unzip -d dist/ sqlite-amalgamation-3310100.zip
rm sqlite-amalgamation-3310100.zip
touch $@
dist/t3310100: demo.c dist/sqlite-amalgamation-3310100
gcc \
-DSQLITE_CORE \
-I dist/sqlite-amalgamation-3310100 \
-I ../../ \
$< dist/sqlite-amalgamation-3310100/sqlite3.c \
../../sqlite-vec.c \
-o $@
test:
make dist/t3310100
./dist/t3310100

26
tests/minimum/demo.c Normal file
View file

@ -0,0 +1,26 @@
#include "sqlite3.h"
#include "sqlite-vec.h"
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
int main(int argc, char *argv[]) {
int rc = SQLITE_OK;
sqlite3 *db;
sqlite3_stmt *stmt;
rc = sqlite3_auto_extension((void (*)())sqlite3_vec_init);
assert(rc == SQLITE_OK);
rc = sqlite3_open(":memory:", &db);
assert(rc == SQLITE_OK);
rc = sqlite3_prepare_v2(db, "SELECT sqlite_version(), vec_version()", -1, &stmt, NULL);
assert(rc == SQLITE_OK);
rc = sqlite3_step(stmt);
printf("sqlite_version=%s, vec_version=%s\n", sqlite3_column_text(stmt, 0), sqlite3_column_text(stmt, 1));
sqlite3_finalize(stmt);
sqlite3_close(db);
return 0;
}