summaryrefslogtreecommitdiff
path: root/libodb/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libodb/tests')
-rw-r--r--libodb/tests/.gitignore1
-rw-r--r--libodb/tests/basics/buildfile6
-rw-r--r--libodb/tests/basics/driver.cxx29
-rw-r--r--libodb/tests/build/.gitignore3
-rw-r--r--libodb/tests/build/bootstrap.build8
-rw-r--r--libodb/tests/build/root.build23
-rw-r--r--libodb/tests/buildfile4
7 files changed, 74 insertions, 0 deletions
diff --git a/libodb/tests/.gitignore b/libodb/tests/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/libodb/tests/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/libodb/tests/basics/buildfile b/libodb/tests/basics/buildfile
new file mode 100644
index 0000000..d568216
--- /dev/null
+++ b/libodb/tests/basics/buildfile
@@ -0,0 +1,6 @@
+# file : tests/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libs = libodb%lib{odb}
+
+exe{driver}: {hxx cxx}{*} $libs
diff --git a/libodb/tests/basics/driver.cxx b/libodb/tests/basics/driver.cxx
new file mode 100644
index 0000000..57cec1c
--- /dev/null
+++ b/libodb/tests/basics/driver.cxx
@@ -0,0 +1,29 @@
+// file : tests/basics/driver.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+// Basic test to make sure the library is usable. Functionality testing
+// is done in the odb-tests package.
+
+#include <cassert>
+
+#include <odb/exceptions.hxx>
+#include <odb/transaction.hxx>
+
+using namespace odb;
+
+int
+main ()
+{
+ // Transaction.
+ //
+ {
+ assert (!transaction::has_current ());
+
+ try
+ {
+ transaction::current ();
+ assert(false);
+ }
+ catch (const not_in_transaction&) {}
+ }
+}
diff --git a/libodb/tests/build/.gitignore b/libodb/tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libodb/tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libodb/tests/build/bootstrap.build b/libodb/tests/build/bootstrap.build
new file mode 100644
index 0000000..6ee38db
--- /dev/null
+++ b/libodb/tests/build/bootstrap.build
@@ -0,0 +1,8 @@
+# file : tests/build/bootstrap.build
+# license : GNU GPL v2; see accompanying LICENSE file
+
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/libodb/tests/build/root.build b/libodb/tests/build/root.build
new file mode 100644
index 0000000..6c5a90b
--- /dev/null
+++ b/libodb/tests/build/root.build
@@ -0,0 +1,23 @@
+# file : tests/build/root.build
+# license : GNU GPL v2; see accompanying LICENSE file
+
+cxx.std = latest
+
+using cxx
+
+hxx{*}: extension = hxx
+cxx{*}: extension = cxx
+
+if ($cxx.target.system == 'win32-msvc')
+ cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+
+if ($cxx.class == 'msvc')
+ cxx.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 = $cxx.target
diff --git a/libodb/tests/buildfile b/libodb/tests/buildfile
new file mode 100644
index 0000000..57588a4
--- /dev/null
+++ b/libodb/tests/buildfile
@@ -0,0 +1,4 @@
+# file : tests/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: {*/ -build/}