mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
sqlite3/tests: Add missing test-prepare.c
This commit is contained in:
parent
58260a356a
commit
54feddabed
1 changed files with 24 additions and 0 deletions
24
sqlite3/tests/test-prepare.c
Normal file
24
sqlite3/tests/test-prepare.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "check.h"
|
||||
|
||||
#include <sqlite3.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void test_prepare_misuse(void)
|
||||
{
|
||||
sqlite3 *db;
|
||||
|
||||
CHECK_EQUAL(SQLITE_OK, sqlite3_open("../../testing/testing.db", &db));
|
||||
|
||||
// Database handle is NULL.
|
||||
CHECK_EQUAL(SQLITE_MISUSE, sqlite3_prepare_v2(NULL, "SELECT 1", -1, NULL, NULL));
|
||||
|
||||
// Output statement is NULL.
|
||||
CHECK_EQUAL(SQLITE_MISUSE, sqlite3_prepare_v2(db, "SELECT 1", -1, NULL, NULL));
|
||||
|
||||
// SQL string length is too short, truncating the statement.
|
||||
CHECK_EQUAL(SQLITE_MISUSE, sqlite3_prepare_v2(db, "SELECT 1", 7, NULL, NULL));
|
||||
|
||||
CHECK_EQUAL(SQLITE_OK, sqlite3_close(db));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue