aboutsummaryrefslogtreecommitdiff
path: root/common/const
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-11-28 17:52:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-11-28 17:52:25 +0200
commit0b4c59824e3b2b0411dd33835c67f6cd36d60a91 (patch)
tree3d1740029ae6a4fc388500787413cac5af6d4abb /common/const
parent3b27ca96f2f4c2b76f65675a988482e19220fa66 (diff)
Simplify tests by using literal names
Diffstat (limited to 'common/const')
-rw-r--r--common/const/driver.cxx14
-rw-r--r--common/const/test.hxx17
2 files changed, 11 insertions, 20 deletions
diff --git a/common/const/driver.cxx b/common/const/driver.cxx
index cc58cf8..e26fb3c 100644
--- a/common/const/driver.cxx
+++ b/common/const/driver.cxx
@@ -33,15 +33,15 @@ main (int argc, char* argv[])
aggr ca_ (2); // o1 and o2 are NULL
const aggr& ca (ca_);
- obj1_ptr o1 (new obj1 (1));
- obj1_ptr co1_ (new obj1 (2));
- obj1_cptr co1 (co1_);
+ obj1* o1 (new obj1 (1));
+ obj1* co1_ (new obj1 (2));
+ const obj1* co1 (co1_);
a.o1 = co1;
- obj2_ptr o2 (new obj2 (1));
+ auto_ptr<obj2> o2 (new obj2 (1));
obj2* co2_ (new obj2 (2));
a.o2.reset (co2_);
- obj2_cptr& co2 (a.o2);
+ auto_ptr<const obj2>& co2 (a.o2);
// persist via references
//
@@ -129,7 +129,7 @@ main (int argc, char* argv[])
{
// i->f (); // error
i->cf ();
- obj1_cptr p (i.load ());
+ const obj1* p (i.load ());
obj1 o (0);
i.load (o);
assert (p->id == o.id);
@@ -144,7 +144,7 @@ main (int argc, char* argv[])
{
// i->f (); // error
i->cf ();
- obj2_cptr p (i.load ());
+ auto_ptr<const obj2> p (i.load ());
obj2 o (0);
i.load (o);
assert (p->id == o.id);
diff --git a/common/const/test.hxx b/common/const/test.hxx
index 7e8a718..0164880 100644
--- a/common/const/test.hxx
+++ b/common/const/test.hxx
@@ -9,16 +9,7 @@
#include <memory>
#include <odb/core.hxx>
-struct obj1;
-struct obj2;
-
-typedef obj1* obj1_ptr;
-typedef const obj1* obj1_cptr;
-
-typedef std::auto_ptr<obj2> obj2_ptr;
-typedef std::auto_ptr<const obj2> obj2_cptr;
-
-#pragma db object pointer (obj1_ptr)
+#pragma db object pointer (obj1*)
struct obj1
{
obj1 () {}
@@ -31,7 +22,7 @@ struct obj1
void cf () const {}
};
-#pragma db object pointer (obj2_ptr)
+#pragma db object pointer (std::auto_ptr<obj2>)
struct obj2
{
obj2 () {}
@@ -54,8 +45,8 @@ struct aggr
#pragma db id
int id;
- obj1_cptr o1;
- obj2_cptr o2;
+ const obj1* o1;
+ std::auto_ptr<const obj2> o2;
};
#endif // TEST_HXX