aboutsummaryrefslogtreecommitdiff
path: root/common
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
parent3b27ca96f2f4c2b76f65675a988482e19220fa66 (diff)
Simplify tests by using literal names
Diffstat (limited to 'common')
-rw-r--r--common/const/driver.cxx14
-rw-r--r--common/const/test.hxx17
-rw-r--r--common/container/test.hxx9
-rw-r--r--common/query/test.hxx3
-rw-r--r--common/relationship/test.hxx31
5 files changed, 28 insertions, 46 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
diff --git a/common/container/test.hxx b/common/container/test.hxx
index 1f565cd..22bcdda 100644
--- a/common/container/test.hxx
+++ b/common/container/test.hxx
@@ -41,16 +41,13 @@ typedef std::list<std::string> str_list;
typedef std::vector<int> num_vector;
typedef std::vector<std::string> str_vector;
-typedef std::vector<comp> comp_vector;
typedef std::set<int> num_set;
typedef std::set<std::string> str_set;
-typedef std::set<comp> comp_set;
typedef std::map<int, std::string> num_str_map;
typedef std::map<std::string, int> str_num_map;
typedef std::map<int, comp> num_comp_map;
-typedef std::map<comp, std::string> comp_str_map;
#pragma db value
struct cont_comp1
@@ -93,7 +90,7 @@ struct object
str_vector sv;
#pragma db value_column("")
- comp_vector cv;
+ std::vector<comp> cv;
#pragma db unordered
num_vector uv;
@@ -107,14 +104,14 @@ struct object
//
num_set ns;
str_set ss;
- comp_set cs;
+ std::set<comp> cs;
// map
//
num_str_map nsm;
str_num_map snm;
num_comp_map ncm;
- comp_str_map csm;
+ std::map<comp, std::string> csm;
std::string str;
};
diff --git a/common/query/test.hxx b/common/query/test.hxx
index 3d10cc2..883462e 100644
--- a/common/query/test.hxx
+++ b/common/query/test.hxx
@@ -38,9 +38,8 @@ struct person
#pragma db column ("first")
std::string first_name_;
- typedef std::auto_ptr<std::string> string_ptr; // @@ tmp
#pragma db column ("middle") type ("TEXT")
- string_ptr middle_name_;
+ std::auto_ptr<std::string> middle_name_;
#pragma db column ("last")
std::string last_name_;
diff --git a/common/relationship/test.hxx b/common/relationship/test.hxx
index 3f624e5..8305de4 100644
--- a/common/relationship/test.hxx
+++ b/common/relationship/test.hxx
@@ -17,10 +17,7 @@
// Naked pointer.
//
-struct obj1;
-typedef obj1* obj1_ptr;
-
-#pragma db object pointer(obj1_ptr)
+#pragma db object pointer(obj1*)
struct obj1
{
obj1 () {}
@@ -28,7 +25,6 @@ struct obj1
#pragma db id
std::string id;
-
std::string str;
};
@@ -40,7 +36,7 @@ operator== (const obj1& x, const obj1& y)
// vector
//
-typedef std::vector<obj1_ptr> obj1_vec;
+typedef std::vector<obj1*> obj1_vec;
inline bool
operator== (const obj1_vec& x, const obj1_vec& y)
@@ -57,16 +53,16 @@ operator== (const obj1_vec& x, const obj1_vec& y)
// set
//
-struct obj1_ptr_cmp
+struct obj1_cmp
{
bool
- operator() (obj1_ptr x, obj1_ptr y) const
+ operator() (obj1* x, obj1* y) const
{
return (!x || !y) ? x < y : x->id < y->id;
}
};
-typedef std::set<obj1_ptr, obj1_ptr_cmp> obj1_set;
+typedef std::set<obj1*, obj1_cmp> obj1_set;
inline bool
operator== (const obj1_set& x, const obj1_set& y)
@@ -81,7 +77,8 @@ operator== (const obj1_set& x, const obj1_set& y)
if (j == y.end ())
return false;
- obj1_ptr x (*i), y (*j);
+ obj1* x (*i);
+ obj1* y (*j);
if (!(x ? (y && *x == *y) : !y))
return false;
@@ -92,7 +89,7 @@ operator== (const obj1_set& x, const obj1_set& y)
// map
//
-typedef std::map<int, obj1_ptr> obj1_map;
+typedef std::map<int, obj1*> obj1_map;
inline bool
operator== (const obj1_map& x, const obj1_map& y)
@@ -107,7 +104,8 @@ operator== (const obj1_map& x, const obj1_map& y)
if (j == y.end ())
return false;
- obj1_ptr x (i->second), y (j->second);
+ obj1* x (i->second);
+ obj1* y (j->second);
if (!(x ? (y && *x == *y) : !y))
return false;
@@ -118,10 +116,7 @@ operator== (const obj1_map& x, const obj1_map& y)
// auto_ptr
//
-struct obj2;
-typedef std::auto_ptr<obj2> obj2_ptr;
-
-#pragma db object pointer(obj2_ptr)
+#pragma db object pointer(std::auto_ptr<obj2>)
struct obj2
{
obj2 () {}
@@ -210,8 +205,8 @@ struct aggr
#pragma db id auto
unsigned long id;
- obj1_ptr o1;
- obj2_ptr o2;
+ obj1* o1;
+ std::auto_ptr<obj2> o2;
#ifdef HAVE_TR1_MEMORY
obj3_ptr o3;
comp c;