summaryrefslogtreecommitdiff
path: root/odb-tests/qt/mssql/date-time
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-05-08 21:29:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-05-16 10:12:03 +0300
commit5ac802457ccf985b334ee81252c185f1d3e1cfb7 (patch)
tree2011186d74b8d662c146d17c65558ef97ff38169 /odb-tests/qt/mssql/date-time
parent71be31b2c14a2d72ff9d301be848d4c5f9e8023d (diff)
Add boost/ and qt/ to odb-tests and odb-examples
Diffstat (limited to 'odb-tests/qt/mssql/date-time')
-rw-r--r--odb-tests/qt/mssql/date-time/buildfile39
-rw-r--r--odb-tests/qt/mssql/date-time/driver.cxx14
-rw-r--r--odb-tests/qt/mssql/date-time/testscript11
3 files changed, 58 insertions, 6 deletions
diff --git a/odb-tests/qt/mssql/date-time/buildfile b/odb-tests/qt/mssql/date-time/buildfile
new file mode 100644
index 0000000..7dc5549
--- /dev/null
+++ b/odb-tests/qt/mssql/date-time/buildfile
@@ -0,0 +1,39 @@
+# file : qt/mssql/date-time/buildfile
+# license : GNU GPL v2; see accompanying LICENSE file
+
+if ($build.meta_operation != 'dist')
+{
+ assert ($qt) \
+ "Qt version should be configured for this test via config.odb_tests.qt variable"
+
+ assert ($mssql) "mssql should be configured for this test"
+ assert (!$multi) "multi-database mode is not supported by this test"
+}
+
+import meta_libs = libodb%lib{odb}
+import meta_libs += libodb-qt%lib{odb-qt}
+import meta_libs += "libQt$(qt_ver)Core"%lib{"Qt$(qt_ver)Core"}
+
+import libs = libodb-mssql%lib{odb-mssql}
+import libs += lib{common}
+
+exe{driver}: {hxx cxx}{* -test-odb} {hxx ixx cxx}{test-odb} testscript
+
+# Introduce the metadata library target to make sure the libodb library is
+# resolved for the odb_compile ad hoc rule (see build/root.build for details).
+#
+libue{test-meta}: $meta_libs
+
+<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta}
+
+exe{driver}: libue{test-meta} $libs
+
+# Specify the ODB custom options to be used by the odb_compile ad hoc rule
+# (see build/root.build for details).
+#
+odb_options = --std ($qt_ver == 5 ? c++11 : c++17) \
+ --table-prefix qt_mssql_dt_ \
+ --profile qt/date-time \
+ --generate-schema
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/odb-tests/qt/mssql/date-time/driver.cxx b/odb-tests/qt/mssql/date-time/driver.cxx
index 9b4320e..a555c10 100644
--- a/odb-tests/qt/mssql/date-time/driver.cxx
+++ b/odb-tests/qt/mssql/date-time/driver.cxx
@@ -4,8 +4,7 @@
// Test Qt date/time type persistence. SQL Server version.
//
-#include <memory> // std::auto_ptr
-#include <cassert>
+#include <memory> // std::unique_ptr
#include <iostream>
#include <QtCore/QDateTime>
@@ -14,11 +13,14 @@
#include <odb/mssql/database.hxx>
#include <odb/mssql/transaction.hxx>
-#include <common/common.hxx>
+#include <libcommon/common.hxx>
#include "test.hxx"
#include "test-odb.hxx"
+#undef NDEBUG
+#include <cassert>
+
using namespace std;
using namespace odb::core;
@@ -29,7 +31,7 @@ main (int argc, char* argv[])
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ unique_ptr<database> db (create_database (argc, argv));
object o;
@@ -43,7 +45,7 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
- auto_ptr<object> ol (db->load<object> (o.id));
+ unique_ptr<object> ol (db->load<object> (o.id));
t.commit ();
assert (ol->is_null ());
@@ -80,7 +82,7 @@ main (int argc, char* argv[])
{
transaction t (db->begin ());
- auto_ptr<object> ol (db->load<object> (o.id));
+ unique_ptr<object> ol (db->load<object> (o.id));
t.commit ();
assert (*ol == o);
diff --git a/odb-tests/qt/mssql/date-time/testscript b/odb-tests/qt/mssql/date-time/testscript
new file mode 100644
index 0000000..16e5453
--- /dev/null
+++ b/odb-tests/qt/mssql/date-time/testscript
@@ -0,0 +1,11 @@
+# file : qt/mssql/basic/testscript
+# license : GNU GPL v2; see accompanying LICENSE file
+
+.include ../../../database-options.testscript
+.include ../../../mssql.testscript
+
++$create_schema
+
+: basics
+:
+$*