diff options
Diffstat (limited to 'odb-tests/boost/sqlite/date-time')
-rw-r--r-- | odb-tests/boost/sqlite/date-time/buildfile | 35 | ||||
-rw-r--r-- | odb-tests/boost/sqlite/date-time/driver.cxx | 20 | ||||
-rw-r--r-- | odb-tests/boost/sqlite/date-time/testscript | 9 |
3 files changed, 55 insertions, 9 deletions
diff --git a/odb-tests/boost/sqlite/date-time/buildfile b/odb-tests/boost/sqlite/date-time/buildfile new file mode 100644 index 0000000..dbf398f --- /dev/null +++ b/odb-tests/boost/sqlite/date-time/buildfile @@ -0,0 +1,35 @@ +# file : boost/sqlite/date-time/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +if ($build.meta_operation != 'dist') +{ + assert ($sqlite) "sqlite 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-boost%lib{odb-boost} +import meta_libs += libboost-date-time%lib{boost_date_time} + +import libs = libodb-sqlite%lib{odb-sqlite} +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 = --table-prefix boost_sqlite_dt_ \ + --profile boost/date-time \ + --generate-schema + +cxx.poptions =+ "-I$out_base" "-I$src_base" diff --git a/odb-tests/boost/sqlite/date-time/driver.cxx b/odb-tests/boost/sqlite/date-time/driver.cxx index 97a7a0c..c630255 100644 --- a/odb-tests/boost/sqlite/date-time/driver.cxx +++ b/odb-tests/boost/sqlite/date-time/driver.cxx @@ -4,14 +4,13 @@ // Test boost date/time type persistence. SQLite version. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/sqlite/database.hxx> #include <odb/sqlite/transaction.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/gregorian/gregorian.hpp> @@ -19,6 +18,9 @@ #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; using namespace boost::gregorian; @@ -27,17 +29,17 @@ using namespace boost::posix_time; using namespace odb::core; bool -test_invalid_special_value (object&, auto_ptr<database>&); +test_invalid_special_value (object&, unique_ptr<database>&); bool -test_out_of_range_value (object&, auto_ptr<database>&); +test_out_of_range_value (object&, unique_ptr<database>&); int main (int argc, char* argv[]) { try { - auto_ptr<database> db (create_database (argc, argv)); + unique_ptr<database> db (create_database (argc, argv)); object o; @@ -84,7 +86,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); @@ -178,7 +180,7 @@ main (int argc, char* argv[]) } bool -test_invalid_special_value (object& x, auto_ptr<database>& db) +test_invalid_special_value (object& x, unique_ptr<database>& db) { try { @@ -193,7 +195,7 @@ test_invalid_special_value (object& x, auto_ptr<database>& db) } bool -test_out_of_range_value (object& x, auto_ptr<database>& db) +test_out_of_range_value (object& x, unique_ptr<database>& db) { try { diff --git a/odb-tests/boost/sqlite/date-time/testscript b/odb-tests/boost/sqlite/date-time/testscript new file mode 100644 index 0000000..5805a80 --- /dev/null +++ b/odb-tests/boost/sqlite/date-time/testscript @@ -0,0 +1,9 @@ +# file : boost/sqlite/date-time/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../../database-options.testscript +.include ../../../sqlite.testscript + +: basics +: +$* |