summaryrefslogtreecommitdiff
path: root/libodb-pgsql/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libodb-pgsql/tests')
-rw-r--r--libodb-pgsql/tests/.gitignore1
-rw-r--r--libodb-pgsql/tests/basics/buildfile6
-rw-r--r--libodb-pgsql/tests/basics/driver.cxx37
-rw-r--r--libodb-pgsql/tests/build/.gitignore3
-rw-r--r--libodb-pgsql/tests/build/bootstrap.build8
-rw-r--r--libodb-pgsql/tests/build/root.build23
-rw-r--r--libodb-pgsql/tests/buildfile4
7 files changed, 82 insertions, 0 deletions
diff --git a/libodb-pgsql/tests/.gitignore b/libodb-pgsql/tests/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/libodb-pgsql/tests/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/libodb-pgsql/tests/basics/buildfile b/libodb-pgsql/tests/basics/buildfile
new file mode 100644
index 0000000..fccb243
--- /dev/null
+++ b/libodb-pgsql/tests/basics/buildfile
@@ -0,0 +1,6 @@
+# file : tests/basics/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+import libs = libodb-pgsql%lib{odb-pgsql}
+
+exe{driver}: {hxx cxx}{*} $libs
diff --git a/libodb-pgsql/tests/basics/driver.cxx b/libodb-pgsql/tests/basics/driver.cxx
new file mode 100644
index 0000000..efd1985
--- /dev/null
+++ b/libodb-pgsql/tests/basics/driver.cxx
@@ -0,0 +1,37 @@
+// 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 <sstream>
+
+#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/exceptions.hxx>
+#include <odb/pgsql/transaction.hxx>
+
+using namespace odb::pgsql;
+
+int
+main ()
+{
+ {
+ std::ostringstream os;
+ database::print_usage (os);
+ assert (!os.str ().empty ());
+ }
+
+ // We can't really do much here since that would require a database. We can
+ // create a fake database object as long as we don't expect to get a valid
+ // connection.
+ //
+ database db ("john", "secret", "dummy whammy");
+
+ try
+ {
+ transaction t (db.begin ());
+ assert (false);
+ }
+ catch (const database_exception&) {}
+}
diff --git a/libodb-pgsql/tests/build/.gitignore b/libodb-pgsql/tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libodb-pgsql/tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libodb-pgsql/tests/build/bootstrap.build b/libodb-pgsql/tests/build/bootstrap.build
new file mode 100644
index 0000000..6ee38db
--- /dev/null
+++ b/libodb-pgsql/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-pgsql/tests/build/root.build b/libodb-pgsql/tests/build/root.build
new file mode 100644
index 0000000..6c5a90b
--- /dev/null
+++ b/libodb-pgsql/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-pgsql/tests/buildfile b/libodb-pgsql/tests/buildfile
new file mode 100644
index 0000000..57588a4
--- /dev/null
+++ b/libodb-pgsql/tests/buildfile
@@ -0,0 +1,4 @@
+# file : tests/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+./: {*/ -build/}