limbo/sqlite3/tests/test-open.c
Pekka Enberg f5cc3a08f0 Initial pass on SQLite C ABI
This adds initial SQLite C ABI compatibility to Limbo to make sure we
drive the Rust API in the right way that allows us to implement SQLite
semantics.
2024-05-08 07:05:56 -03:00

30 lines
564 B
C

#include "check.h"
#include <sqlite3.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
void test_open_misuse(void)
{
CHECK_EQUAL(SQLITE_MISUSE, sqlite3_open(NULL, NULL));
CHECK_EQUAL(SQLITE_MISUSE, sqlite3_open("local.db", NULL));
}
void test_open_not_found(void)
{
sqlite3 *db;
CHECK_EQUAL(SQLITE_CANTOPEN, sqlite3_open("not-found/local.db", &db));
}
// TODO: test_open_create
void test_open_existing(void)
{
sqlite3 *db;
CHECK_EQUAL(SQLITE_OK, sqlite3_open("../../testing/hello.db", &db));
CHECK_EQUAL(SQLITE_OK, sqlite3_close(db));
}