aboutsummaryrefslogtreecommitdiff
path: root/common/lifecycle/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/lifecycle/driver.cxx')
-rw-r--r--common/lifecycle/driver.cxx30
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 ();
}