diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-08 21:29:52 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-05-16 10:12:03 +0300 |
commit | 5ac802457ccf985b334ee81252c185f1d3e1cfb7 (patch) | |
tree | 2011186d74b8d662c146d17c65558ef97ff38169 /odb-tests/qt/common/basic | |
parent | 71be31b2c14a2d72ff9d301be848d4c5f9e8023d (diff) |
Add boost/ and qt/ to odb-tests and odb-examples
Diffstat (limited to 'odb-tests/qt/common/basic')
-rw-r--r-- | odb-tests/qt/common/basic/buildfile | 51 | ||||
-rw-r--r-- | odb-tests/qt/common/basic/driver.cxx | 12 | ||||
-rw-r--r-- | odb-tests/qt/common/basic/testscript | 53 |
3 files changed, 111 insertions, 5 deletions
diff --git a/odb-tests/qt/common/basic/buildfile b/odb-tests/qt/common/basic/buildfile new file mode 100644 index 0000000..cb06233 --- /dev/null +++ b/odb-tests/qt/common/basic/buildfile @@ -0,0 +1,51 @@ +# file : qt/common/basic/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" +} + +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"} + +libs = + +for db: $databases + import libs += libodb-$db%lib{odb-$db} + +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -test-odb -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} + +for db: $databases +{ + exe{driver}: {hxx ixx cxx}{test-odb-$db}: include = $multi + <{hxx ixx cxx}{test-odb-$db}>: 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_basic_ \ + --profile qt/basic \ + --generate-schema \ + --generate-query + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../../alias{database-client}: include = adhoc diff --git a/odb-tests/qt/common/basic/driver.cxx b/odb-tests/qt/common/basic/driver.cxx index 342a313..90c7d20 100644 --- a/odb-tests/qt/common/basic/driver.cxx +++ b/odb-tests/qt/common/basic/driver.cxx @@ -4,18 +4,20 @@ // Test Qt basic type persistence (common part). // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/database.hxx> #include <odb/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; @@ -24,7 +26,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 (1); o.uuid_ = QUuid::createUuid (); @@ -39,7 +41,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> p (db->load<object> (o.id_)); + unique_ptr<object> p (db->load<object> (o.id_)); t.commit (); assert (*p == o); diff --git a/odb-tests/qt/common/basic/testscript b/odb-tests/qt/common/basic/testscript new file mode 100644 index 0000000..02be561 --- /dev/null +++ b/odb-tests/qt/common/basic/testscript @@ -0,0 +1,53 @@ +# file : qt/common/basic/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../../database-options.testscript + +: mysql +: +if $mysql +{ + .include ../../../mysql.testscript + + $create_schema; + $* +} + +: sqlite +: +if $sqlite +{ + .include ../../../sqlite.testscript + + $* +} + +: pgsql +: +if $pgsql +{ + .include ../../../pgsql.testscript + + $create_schema; + $* +} + +: oracle +: +if $oracle +{ + .include ../../../oracle.testscript + + $create_schema; + $* +} + +: mssql +: +if $mssql +{ + .include ../../../mssql.testscript + + $create_schema; + $* +} |