summaryrefslogtreecommitdiff
path: root/odb-tests/sqlite/database
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-01-25 20:32:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-01-25 20:32:06 +0300
commit0d49ea1fe08cf1eab41a00149393a291c65a59d7 (patch)
tree0391eb09309ca95282e200516937e64d89f3e1bb /odb-tests/sqlite/database
parentfc3fb39c90ab7fe5fccbe3f3bc0eb2645157bb96 (diff)
Turn odb-tests repository into package for muti-package repositoryodb-tests
Diffstat (limited to 'odb-tests/sqlite/database')
-rw-r--r--odb-tests/sqlite/database/buildfile11
-rw-r--r--odb-tests/sqlite/database/driver.cxx40
-rw-r--r--odb-tests/sqlite/database/testscript6
3 files changed, 57 insertions, 0 deletions
diff --git a/odb-tests/sqlite/database/buildfile b/odb-tests/sqlite/database/buildfile
new file mode 100644
index 0000000..e74ab1a
--- /dev/null
+++ b/odb-tests/sqlite/database/buildfile
@@ -0,0 +1,11 @@
+# file : sqlite/database/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+assert ($sqlite && !$multi || $build.meta_operation == 'dist') \
+"sqlite should be configured via config.odb_tests.database variable as a single database"
+
+import libs = libodb-sqlite%lib{odb-sqlite}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/sqlite/database/driver.cxx b/odb-tests/sqlite/database/driver.cxx
new file mode 100644
index 0000000..5e16653
--- /dev/null
+++ b/odb-tests/sqlite/database/driver.cxx
@@ -0,0 +1,40 @@
+// file : sqlite/database/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Test that database constructors are unambiguous and some other things.
+//
+
+#include <odb/sqlite/database.hxx>
+
+#undef NDEBUG
+#include <cassert>
+
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
+
+int
+main (int argc, char* argv[])
+{
+ // Test UTF-16 to UTF-8 conversion.
+ //
+#ifdef _WIN32
+ {
+ database d (L"t\x00C8st");
+ assert (d.name () == "t\xC3\x88st");
+ }
+#endif
+
+ // This code should not execute.
+ //
+ if (argc != 0)
+ return 0;
+
+ {
+ database d1 ("db1");
+ }
+
+ {
+ database d1 (argc, argv);
+ database d2 (argc, argv, false);
+ }
+}
diff --git a/odb-tests/sqlite/database/testscript b/odb-tests/sqlite/database/testscript
new file mode 100644
index 0000000..b9c0f5f
--- /dev/null
+++ b/odb-tests/sqlite/database/testscript
@@ -0,0 +1,6 @@
+# file : sqlite/database/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+: basics
+:
+$*