diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-12-13 21:57:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-01-23 21:20:44 +0300 |
commit | fc3fb39c90ab7fe5fccbe3f3bc0eb2645157bb96 (patch) | |
tree | 6c8c1bfb5fe89f7378b92ac066b4ca8ecfd25228 /common/lifecycle/driver.cxx | |
parent | 02367faedb16b6186e8852de47e5b749dc48c2df (diff) |
Switch to build2
Diffstat (limited to 'common/lifecycle/driver.cxx')
-rw-r--r-- | common/lifecycle/driver.cxx | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/common/lifecycle/driver.cxx b/common/lifecycle/driver.cxx index 460cae1..a01d5bd 100644 --- a/common/lifecycle/driver.cxx +++ b/common/lifecycle/driver.cxx @@ -4,18 +4,20 @@ // Test object state transistions. // -#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)); // Database operation out of transaction. // @@ -43,7 +45,7 @@ main (int argc, char* argv[]) try { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); assert (false); t.commit (); } @@ -78,10 +80,10 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> o1 (db->find<object> (1)); + unique_ptr<object> o1 (db->find<object> (1)); assert (o1.get () != 0 && o1->str_ == "value 1"); - auto_ptr<object> o2 (db->find<object> (2)); + unique_ptr<object> o2 (db->find<object> (2)); assert (o2.get () == 0); t.commit (); @@ -106,14 +108,14 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); assert (o->str_ == "value 1"); t.commit (); try { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (2)); + unique_ptr<object> o (db->load<object> (2)); assert (false); t.commit (); } @@ -173,7 +175,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); o->str_ = "value 2"; db->update (*o); t.commit (); @@ -193,7 +195,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); assert (o->str_ == "value 2"); t.commit (); } @@ -202,7 +204,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); db->update (*o); t.commit (); } @@ -211,7 +213,7 @@ main (int argc, char* argv[]) // { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); db->erase (*o); t.commit (); @@ -230,7 +232,7 @@ main (int argc, char* argv[]) try { transaction t (db->begin ()); - auto_ptr<object> o (db->load<object> (1)); + unique_ptr<object> o (db->load<object> (1)); assert (false); t.commit (); } |