summaryrefslogtreecommitdiff
path: root/libsqlite3/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-03-11 16:47:49 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-03-11 16:47:49 +0300
commit3d3a63d289cdaa8bc4d4a3820d499ea5a3205b43 (patch)
treee608c7ebe88503c670fcec02b6db5f54a6843dd2 /libsqlite3/test
parentaa5ecc3b21bf88c5b9b9c17912e4efbd96eeab34 (diff)
Release version 3.18.2+7v3.18.2
Place libsqlite3 and sqlite3 packages into single repository.
Diffstat (limited to 'libsqlite3/test')
-rw-r--r--libsqlite3/test/.gitignore1
-rw-r--r--libsqlite3/test/build/.gitignore3
-rw-r--r--libsqlite3/test/build/bootstrap.build8
-rw-r--r--libsqlite3/test/build/root.build18
-rw-r--r--libsqlite3/test/buildfile6
-rw-r--r--libsqlite3/test/driver.c56
6 files changed, 92 insertions, 0 deletions
diff --git a/libsqlite3/test/.gitignore b/libsqlite3/test/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/libsqlite3/test/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/libsqlite3/test/build/.gitignore b/libsqlite3/test/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libsqlite3/test/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libsqlite3/test/build/bootstrap.build b/libsqlite3/test/build/bootstrap.build
new file mode 100644
index 0000000..49e8cc2
--- /dev/null
+++ b/libsqlite3/test/build/bootstrap.build
@@ -0,0 +1,8 @@
+# file : test/build/bootstrap.build
+# copyright : not copyrighted - public domain
+
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/libsqlite3/test/build/root.build b/libsqlite3/test/build/root.build
new file mode 100644
index 0000000..2db66fd
--- /dev/null
+++ b/libsqlite3/test/build/root.build
@@ -0,0 +1,18 @@
+# file : test/build/root.build
+# copyright : not copyrighted - public domain
+
+using c
+
+if ($c.class == 'msvc')
+{
+ c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+ c.coptions += /wd4251 /wd4275 /wd4800
+}
+
+# Every exe{} in this subproject is by default a test.
+#
+exe{*}: test = true
+
+# Specify the test target for cross-testing.
+#
+test.target = $c.target
diff --git a/libsqlite3/test/buildfile b/libsqlite3/test/buildfile
new file mode 100644
index 0000000..b3f54ef
--- /dev/null
+++ b/libsqlite3/test/buildfile
@@ -0,0 +1,6 @@
+# file : test/buildfile
+# copyright : not copyrighted - public domain
+
+import libs = libsqlite3%lib{sqlite3}
+
+exe{driver}: {h c}{*} $libs
diff --git a/libsqlite3/test/driver.c b/libsqlite3/test/driver.c
new file mode 100644
index 0000000..2eabb06
--- /dev/null
+++ b/libsqlite3/test/driver.c
@@ -0,0 +1,56 @@
+/* file : test/driver.c
+ * copyright : not copyrighted - public domain
+ */
+
+/*
+ * Basic test to make sure the library is usable.
+ */
+
+#ifdef NDEBUG
+# undef NDEBUG
+#endif
+
+#include <sqlite3.h>
+
+#include <stddef.h> /* NULL */
+#include <assert.h>
+
+static int
+sql (sqlite3* db, const char* stmt)
+{
+ return sqlite3_exec (db, stmt, NULL, NULL, NULL) == SQLITE_OK;
+}
+
+int
+main ()
+{
+ sqlite3* db;
+ int r;
+
+ r = sqlite3_open_v2 (":memory:",
+ &db,
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
+ NULL);
+ assert (r == SQLITE_OK);
+
+ assert (sql (db, "BEGIN"));
+ assert (sql (db, "CREATE TABLE test (id INTEGER PRIMARY KEY, str TEXT)"));
+ assert (sql (db, "COMMIT"));
+
+ assert (sql (db, "BEGIN"));
+ assert (sql (db, "INSERT INTO test VALUES (123, 'abc')"));
+ assert (sql (db, "COMMIT"));
+
+ assert (sql (db, "BEGIN"));
+ assert (!sql (db, "INSERT INTO test VALUES (123, 'ABC')"));
+ assert (sql (db, "ROLLBACK"));
+
+ assert (sql (db, "BEGIN"));
+ assert (sql (db, "DROP TABLE test"));
+ assert (sql (db, "COMMIT"));
+
+ r = sqlite3_close (db);
+ assert (r == SQLITE_OK);
+
+ return 0;
+}