mirror of
https://github.com/boostorg/multi_index.git
synced 2025-05-09 23:14:04 +00:00
merged [82897], [82970] and [82993] from trunk
[SVN r83003]
This commit is contained in:
parent
b35a722129
commit
0f583940c9
@ -31,6 +31,7 @@ Acknowledgements
|
||||
<h2>Contents</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="#boost_1_54">Boost 1.54 release</a></li>
|
||||
<li><a href="#boost_1_49">Boost 1.49 release</a></li>
|
||||
<li><a href="#boost_1_48">Boost 1.48 release</a></li>
|
||||
<li><a href="#boost_1_47">Boost 1.47 release</a></li>
|
||||
@ -47,6 +48,17 @@ Acknowledgements
|
||||
<li><a href="#boost_1_33">Boost 1.33 release</a></li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="boost_1_54">Boost 1.54 release</a></h2>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li>Suppressed some potential warnings described in
|
||||
ticket <a href="https://svn.boost.org/trac/boost/ticket/8034">#8034</a>.
|
||||
</li>
|
||||
<li>Maintenance fixes.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2><a name="boost_1_49">Boost 1.49 release</a></h2>
|
||||
|
||||
<p>
|
||||
@ -359,9 +371,9 @@ Acknowledgements
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised November 24th 2011</p>
|
||||
<p>Revised February 18th 2013</p>
|
||||
|
||||
<p>© Copyright 2003-2011 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2013 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -106,14 +106,14 @@ class algorithm_base:private noncopyable
|
||||
{
|
||||
protected:
|
||||
algorithm_base(const Allocator& al,std::size_t size):
|
||||
spc(al,size),size_(size),n(0),sorted(false)
|
||||
spc(al,size),size_(size),n_(0),sorted(false)
|
||||
{
|
||||
}
|
||||
|
||||
void add(void* node)
|
||||
{
|
||||
entries()[n]=entry(node,n);
|
||||
++n;
|
||||
entries()[n_]=entry(node,n_);
|
||||
++n_;
|
||||
}
|
||||
|
||||
void begin_algorithm()const
|
||||
@ -183,7 +183,7 @@ private:
|
||||
|
||||
auto_space<entry,Allocator> spc;
|
||||
std::size_t size_;
|
||||
std::size_t n;
|
||||
std::size_t n_;
|
||||
mutable bool sorted;
|
||||
mutable std::size_t num_piles;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2009 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -142,32 +142,32 @@ inline bool check_valid_iterator(const Iterator& it)
|
||||
template<typename Iterator>
|
||||
inline bool check_dereferenceable_iterator(const Iterator& it)
|
||||
{
|
||||
return it.valid()&&it!=it.owner()->end()||it.unchecked();
|
||||
return (it.valid()&&it!=it.owner()->end())||it.unchecked();
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
inline bool check_incrementable_iterator(const Iterator& it)
|
||||
{
|
||||
return it.valid()&&it!=it.owner()->end()||it.unchecked();
|
||||
return (it.valid()&&it!=it.owner()->end())||it.unchecked();
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
inline bool check_decrementable_iterator(const Iterator& it)
|
||||
{
|
||||
return it.valid()&&it!=it.owner()->begin()||it.unchecked();
|
||||
return (it.valid()&&it!=it.owner()->begin())||it.unchecked();
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
inline bool check_is_owner(
|
||||
const Iterator& it,const typename Iterator::container_type& cont)
|
||||
{
|
||||
return it.valid()&&it.owner()==&cont||it.unchecked();
|
||||
return (it.valid()&&it.owner()==&cont)||it.unchecked();
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
inline bool check_same_owner(const Iterator& it0,const Iterator& it1)
|
||||
{
|
||||
return it0.valid()&&it1.valid()&&it0.owner()==it1.owner()||
|
||||
return (it0.valid()&&it1.valid()&&it0.owner()==it1.owner())||
|
||||
it0.unchecked()||it1.unchecked();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2011 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -288,15 +288,15 @@ public:
|
||||
BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT;
|
||||
|
||||
size_type s=0;
|
||||
std::size_t buc=buckets.position(hash(k));
|
||||
std::size_t buc=buckets.position(hash_(k));
|
||||
node_impl_pointer x=buckets.at(buc);
|
||||
node_impl_pointer y=x->next();
|
||||
while(y!=x){
|
||||
if(eq(k,key(node_type::from_impl(y)->value()))){
|
||||
if(eq_(k,key(node_type::from_impl(y)->value()))){
|
||||
bool b;
|
||||
do{
|
||||
node_impl_pointer z=y->next();
|
||||
b=z!=x&&eq(
|
||||
b=z!=x&&eq_(
|
||||
key(node_type::from_impl(y)->value()),
|
||||
key(node_type::from_impl(z)->value()));
|
||||
this->final_erase_(
|
||||
@ -416,8 +416,8 @@ public:
|
||||
/* observers */
|
||||
|
||||
key_from_value key_extractor()const{return key;}
|
||||
hasher hash_function()const{return hash;}
|
||||
key_equal key_eq()const{return eq;}
|
||||
hasher hash_function()const{return hash_;}
|
||||
key_equal key_eq()const{return eq_;}
|
||||
|
||||
/* lookup */
|
||||
|
||||
@ -428,7 +428,7 @@ public:
|
||||
template<typename CompatibleKey>
|
||||
iterator find(const CompatibleKey& k)const
|
||||
{
|
||||
return find(k,hash,eq);
|
||||
return find(k,hash_,eq_);
|
||||
}
|
||||
|
||||
template<
|
||||
@ -453,7 +453,7 @@ public:
|
||||
template<typename CompatibleKey>
|
||||
size_type count(const CompatibleKey& k)const
|
||||
{
|
||||
return count(k,hash,eq);
|
||||
return count(k,hash_,eq_);
|
||||
}
|
||||
|
||||
template<
|
||||
@ -483,7 +483,7 @@ public:
|
||||
template<typename CompatibleKey>
|
||||
std::pair<iterator,iterator> equal_range(const CompatibleKey& k)const
|
||||
{
|
||||
return equal_range(k,hash,eq);
|
||||
return equal_range(k,hash_,eq_);
|
||||
}
|
||||
|
||||
template<
|
||||
@ -536,7 +536,7 @@ public:
|
||||
|
||||
size_type bucket(key_param_type k)const
|
||||
{
|
||||
return buckets.position(hash(k));
|
||||
return buckets.position(hash_(k));
|
||||
}
|
||||
|
||||
local_iterator begin(size_type n)
|
||||
@ -604,8 +604,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
hashed_index(const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list.get_tail(),al),
|
||||
key(tuples::get<1>(args_list.get_head())),
|
||||
hash(tuples::get<2>(args_list.get_head())),
|
||||
eq(tuples::get<3>(args_list.get_head())),
|
||||
hash_(tuples::get<2>(args_list.get_head())),
|
||||
eq_(tuples::get<3>(args_list.get_head())),
|
||||
buckets(al,header()->impl(),tuples::get<0>(args_list.get_head())),
|
||||
mlf(1.0f),
|
||||
first_bucket(buckets.size())
|
||||
@ -622,8 +622,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
#endif
|
||||
|
||||
key(x.key),
|
||||
hash(x.hash),
|
||||
eq(x.eq),
|
||||
hash_(x.hash_),
|
||||
eq_(x.eq_),
|
||||
buckets(x.get_allocator(),header()->impl(),x.buckets.size()),
|
||||
mlf(x.mlf),
|
||||
max_load(x.max_load),
|
||||
@ -762,8 +762,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x)
|
||||
{
|
||||
std::swap(key,x.key);
|
||||
std::swap(hash,x.hash);
|
||||
std::swap(eq,x.eq);
|
||||
std::swap(hash_,x.hash_);
|
||||
std::swap(eq_,x.eq_);
|
||||
buckets.swap(x.buckets);
|
||||
std::swap(mlf,x.mlf);
|
||||
std::swap(max_load,x.max_load);
|
||||
@ -778,7 +778,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
|
||||
bool replace_(value_param_type v,node_type* x)
|
||||
{
|
||||
if(eq(key(v),key(x->value()))){
|
||||
if(eq_(key(v),key(x->value()))){
|
||||
return super::replace_(v,x);
|
||||
}
|
||||
|
||||
@ -981,7 +981,7 @@ private:
|
||||
{
|
||||
node_impl_pointer x=pos->next();
|
||||
while(x!=pos){
|
||||
if(eq(key(v),key(node_type::from_impl(x)->value()))){
|
||||
if(eq_(key(v),key(node_type::from_impl(x)->value()))){
|
||||
pos=x;
|
||||
return false;
|
||||
}
|
||||
@ -996,7 +996,7 @@ private:
|
||||
node_impl_pointer prev=pos;
|
||||
node_impl_pointer x=pos->next();
|
||||
while(x!=pos){
|
||||
if(eq(key(v),key(node_type::from_impl(x)->value()))){
|
||||
if(eq_(key(v),key(node_type::from_impl(x)->value()))){
|
||||
pos=prev;
|
||||
return true;
|
||||
}
|
||||
@ -1064,7 +1064,7 @@ private:
|
||||
for(;x!=x_end;++x){
|
||||
node_impl_pointer y=x->next();
|
||||
while(y!=x){
|
||||
hashes.data()[i++]=hash(key(node_type::from_impl(y)->value()));
|
||||
hashes.data()[i++]=hash_(key(node_type::from_impl(y)->value()));
|
||||
y=y->next();
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1103,7 @@ private:
|
||||
while(y->next()!=x){
|
||||
y=y->next();
|
||||
if(y==pbuc)continue;
|
||||
if(eq(k,key(node_type::from_impl(y)->value())))return false;
|
||||
if(eq_(k,key(node_type::from_impl(y)->value())))return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1122,24 +1122,24 @@ private:
|
||||
|
||||
node_impl_pointer y=x->next();
|
||||
if(y!=pbuc){
|
||||
if(eq(k,key(node_type::from_impl(y)->value()))){
|
||||
if(eq_(k,key(node_type::from_impl(y)->value()))){
|
||||
/* adjacent to equivalent element -> in place */
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
y=y->next();
|
||||
while(y!=pbuc){
|
||||
if(eq(k,key(node_type::from_impl(y)->value())))return false;
|
||||
if(eq_(k,key(node_type::from_impl(y)->value())))return false;
|
||||
y=y->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
while(y->next()!=x){
|
||||
y=y->next();
|
||||
if(eq(k,key(node_type::from_impl(y)->value()))){
|
||||
if(eq_(k,key(node_type::from_impl(y)->value()))){
|
||||
while(y->next()!=x){
|
||||
y=y->next();
|
||||
if(!eq(k,key(node_type::from_impl(y)->value())))return false;
|
||||
if(!eq_(k,key(node_type::from_impl(y)->value())))return false;
|
||||
}
|
||||
/* after a group of equivalent elements --> in place */
|
||||
return true;
|
||||
@ -1158,8 +1158,8 @@ private:
|
||||
#endif
|
||||
|
||||
key_from_value key;
|
||||
hasher hash;
|
||||
key_equal eq;
|
||||
hasher hash_;
|
||||
key_equal eq_;
|
||||
bucket_array_type buckets;
|
||||
float mlf;
|
||||
size_type max_load;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2011 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -421,8 +421,8 @@ public:
|
||||
/* observers */
|
||||
|
||||
key_from_value key_extractor()const{return key;}
|
||||
key_compare key_comp()const{return comp;}
|
||||
value_compare value_comp()const{return value_compare(key,comp);}
|
||||
key_compare key_comp()const{return comp_;}
|
||||
value_compare value_comp()const{return value_compare(key,comp_);}
|
||||
|
||||
/* set operations */
|
||||
|
||||
@ -433,7 +433,7 @@ public:
|
||||
template<typename CompatibleKey>
|
||||
iterator find(const CompatibleKey& x)const
|
||||
{
|
||||
return make_iterator(ordered_index_find(root(),header(),key,x,comp));
|
||||
return make_iterator(ordered_index_find(root(),header(),key,x,comp_));
|
||||
}
|
||||
|
||||
template<typename CompatibleKey,typename CompatibleCompare>
|
||||
@ -446,7 +446,7 @@ public:
|
||||
template<typename CompatibleKey>
|
||||
size_type count(const CompatibleKey& x)const
|
||||
{
|
||||
return count(x,comp);
|
||||
return count(x,comp_);
|
||||
}
|
||||
|
||||
template<typename CompatibleKey,typename CompatibleCompare>
|
||||
@ -461,7 +461,7 @@ public:
|
||||
iterator lower_bound(const CompatibleKey& x)const
|
||||
{
|
||||
return make_iterator(
|
||||
ordered_index_lower_bound(root(),header(),key,x,comp));
|
||||
ordered_index_lower_bound(root(),header(),key,x,comp_));
|
||||
}
|
||||
|
||||
template<typename CompatibleKey,typename CompatibleCompare>
|
||||
@ -476,7 +476,7 @@ public:
|
||||
iterator upper_bound(const CompatibleKey& x)const
|
||||
{
|
||||
return make_iterator(
|
||||
ordered_index_upper_bound(root(),header(),key,x,comp));
|
||||
ordered_index_upper_bound(root(),header(),key,x,comp_));
|
||||
}
|
||||
|
||||
template<typename CompatibleKey,typename CompatibleCompare>
|
||||
@ -492,7 +492,7 @@ public:
|
||||
const CompatibleKey& x)const
|
||||
{
|
||||
std::pair<node_type*,node_type*> p=
|
||||
ordered_index_equal_range(root(),header(),key,x,comp);
|
||||
ordered_index_equal_range(root(),header(),key,x,comp_);
|
||||
return std::pair<iterator,iterator>(
|
||||
make_iterator(p.first),make_iterator(p.second));
|
||||
}
|
||||
@ -534,7 +534,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
ordered_index(const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list.get_tail(),al),
|
||||
key(tuples::get<0>(args_list.get_head())),
|
||||
comp(tuples::get<1>(args_list.get_head()))
|
||||
comp_(tuples::get<1>(args_list.get_head()))
|
||||
{
|
||||
empty_initialize();
|
||||
}
|
||||
@ -548,7 +548,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
#endif
|
||||
|
||||
key(x.key),
|
||||
comp(x.comp)
|
||||
comp_(x.comp_)
|
||||
{
|
||||
/* Copy ctor just takes the key and compare objects from x. The rest is
|
||||
* done in subsequent call to copy_().
|
||||
@ -680,7 +680,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
void swap_(ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x)
|
||||
{
|
||||
std::swap(key,x.key);
|
||||
std::swap(comp,x.comp);
|
||||
std::swap(comp_,x.comp_);
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
safe_super::swap(x);
|
||||
@ -851,8 +851,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
if((left_x&&left_x->color()==red)||
|
||||
(right_x&&right_x->color()==red))return false;
|
||||
}
|
||||
if(left_x&&comp(key(x->value()),key(left_x->value())))return false;
|
||||
if(right_x&&comp(key(right_x->value()),key(x->value())))return false;
|
||||
if(left_x&&comp_(key(x->value()),key(left_x->value())))return false;
|
||||
if(right_x&&comp_(key(right_x->value()),key(x->value())))return false;
|
||||
if(!left_x&&!right_x&&
|
||||
node_impl_type::black_count(x->impl(),root()->impl())!=len)
|
||||
return false;
|
||||
@ -907,7 +907,7 @@ private:
|
||||
bool c=true;
|
||||
while(x){
|
||||
y=x;
|
||||
c=comp(k,key(x->value()));
|
||||
c=comp_(k,key(x->value()));
|
||||
x=node_type::from_impl(c?x->left():x->right());
|
||||
}
|
||||
node_type* yy=y;
|
||||
@ -920,7 +920,7 @@ private:
|
||||
else node_type::decrement(yy);
|
||||
}
|
||||
|
||||
if(comp(key(yy->value()),k)){
|
||||
if(comp_(key(yy->value()),k)){
|
||||
inf.side=c?to_left:to_right;
|
||||
inf.pos=y->impl();
|
||||
return true;
|
||||
@ -938,7 +938,7 @@ private:
|
||||
bool c=true;
|
||||
while (x){
|
||||
y=x;
|
||||
c=comp(k,key(x->value()));
|
||||
c=comp_(k,key(x->value()));
|
||||
x=node_type::from_impl(c?x->left():x->right());
|
||||
}
|
||||
inf.side=c?to_left:to_right;
|
||||
@ -953,7 +953,7 @@ private:
|
||||
bool c=false;
|
||||
while (x){
|
||||
y=x;
|
||||
c=comp(key(x->value()),k);
|
||||
c=comp_(key(x->value()),k);
|
||||
x=node_type::from_impl(c?x->right():x->left());
|
||||
}
|
||||
inf.side=c?to_right:to_left;
|
||||
@ -965,7 +965,7 @@ private:
|
||||
key_param_type k,node_type* position,link_info& inf,ordered_unique_tag)
|
||||
{
|
||||
if(position->impl()==header()->left()){
|
||||
if(size()>0&&comp(k,key(position->value()))){
|
||||
if(size()>0&&comp_(k,key(position->value()))){
|
||||
inf.side=to_left;
|
||||
inf.pos=position->impl();
|
||||
return true;
|
||||
@ -973,7 +973,7 @@ private:
|
||||
else return link_point(k,inf,ordered_unique_tag());
|
||||
}
|
||||
else if(position==header()){
|
||||
if(comp(key(rightmost()->value()),k)){
|
||||
if(comp_(key(rightmost()->value()),k)){
|
||||
inf.side=to_right;
|
||||
inf.pos=rightmost()->impl();
|
||||
return true;
|
||||
@ -983,7 +983,7 @@ private:
|
||||
else{
|
||||
node_type* before=position;
|
||||
node_type::decrement(before);
|
||||
if(comp(key(before->value()),k)&&comp(k,key(position->value()))){
|
||||
if(comp_(key(before->value()),k)&&comp_(k,key(position->value()))){
|
||||
if(before->right()==node_impl_pointer(0)){
|
||||
inf.side=to_right;
|
||||
inf.pos=before->impl();
|
||||
@ -1003,7 +1003,7 @@ private:
|
||||
key_param_type k,node_type* position,link_info& inf,ordered_non_unique_tag)
|
||||
{
|
||||
if(position->impl()==header()->left()){
|
||||
if(size()>0&&!comp(key(position->value()),k)){
|
||||
if(size()>0&&!comp_(key(position->value()),k)){
|
||||
inf.side=to_left;
|
||||
inf.pos=position->impl();
|
||||
return true;
|
||||
@ -1011,7 +1011,7 @@ private:
|
||||
else return lower_link_point(k,inf,ordered_non_unique_tag());
|
||||
}
|
||||
else if(position==header()){
|
||||
if(!comp(k,key(rightmost()->value()))){
|
||||
if(!comp_(k,key(rightmost()->value()))){
|
||||
inf.side=to_right;
|
||||
inf.pos=rightmost()->impl();
|
||||
return true;
|
||||
@ -1021,8 +1021,8 @@ private:
|
||||
else{
|
||||
node_type* before=position;
|
||||
node_type::decrement(before);
|
||||
if(!comp(k,key(before->value()))){
|
||||
if(!comp(key(position->value()),k)){
|
||||
if(!comp_(k,key(before->value()))){
|
||||
if(!comp_(key(position->value()),k)){
|
||||
if(before->right()==node_impl_pointer(0)){
|
||||
inf.side=to_right;
|
||||
inf.pos=before->impl();
|
||||
@ -1055,12 +1055,12 @@ private:
|
||||
if(x!=leftmost()){
|
||||
y=x;
|
||||
node_type::decrement(y);
|
||||
if(!comp(key(y->value()),key(v)))return false;
|
||||
if(!comp_(key(y->value()),key(v)))return false;
|
||||
}
|
||||
|
||||
y=x;
|
||||
node_type::increment(y);
|
||||
return y==header()||comp(key(v),key(y->value()));
|
||||
return y==header()||comp_(key(v),key(y->value()));
|
||||
}
|
||||
|
||||
bool in_place(value_param_type v,node_type* x,ordered_non_unique_tag)
|
||||
@ -1069,12 +1069,12 @@ private:
|
||||
if(x!=leftmost()){
|
||||
y=x;
|
||||
node_type::decrement(y);
|
||||
if(comp(key(v),key(y->value())))return false;
|
||||
if(comp_(key(v),key(y->value())))return false;
|
||||
}
|
||||
|
||||
y=x;
|
||||
node_type::increment(y);
|
||||
return y==header()||!comp(key(y->value()),key(v));
|
||||
return y==header()||!comp_(key(y->value()),key(v));
|
||||
}
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
@ -1209,10 +1209,10 @@ private:
|
||||
|
||||
void rearranger(node_type* position,node_type *x)
|
||||
{
|
||||
if(!position||comp(key(position->value()),key(x->value()))){
|
||||
if(!position||comp_(key(position->value()),key(x->value()))){
|
||||
position=lower_bound(key(x->value())).get_node();
|
||||
}
|
||||
else if(comp(key(x->value()),key(position->value()))){
|
||||
else if(comp_(key(x->value()),key(position->value()))){
|
||||
/* inconsistent rearrangement */
|
||||
throw_exception(
|
||||
archive::archive_exception(
|
||||
@ -1230,7 +1230,7 @@ private:
|
||||
#endif /* serialization */
|
||||
|
||||
key_from_value key;
|
||||
key_compare comp;
|
||||
key_compare comp_;
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\
|
||||
BOOST_WORKAROUND(__MWERKS__,<=0x3003)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test suite.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,7 +8,7 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_basic.hpp"
|
||||
#include "test_capacity.hpp"
|
||||
#include "test_comparison.hpp"
|
||||
@ -31,7 +31,7 @@
|
||||
#include "test_special_set_ops.hpp"
|
||||
#include "test_update.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_basic();
|
||||
test_capacity();
|
||||
@ -55,5 +55,5 @@ int test_main(int,char *[])
|
||||
test_special_set_ops();
|
||||
test_update();
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex basic test.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -15,7 +15,7 @@
|
||||
#include <vector>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -60,22 +60,22 @@ void test_basic()
|
||||
{
|
||||
/* by insertion order */
|
||||
|
||||
BOOST_CHECK(std::equal(i3.begin(),i3.end(),v.begin()));
|
||||
BOOST_CHECK(std::equal(i5.begin(),i5.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(i3.begin(),i3.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(i5.begin(),i5.end(),v.begin()));
|
||||
}
|
||||
|
||||
{
|
||||
/* by id */
|
||||
|
||||
std::sort(v.begin(),v.end());
|
||||
BOOST_CHECK(std::equal(es.begin(),es.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(es.begin(),es.end(),v.begin()));
|
||||
}
|
||||
|
||||
{
|
||||
/* by age */
|
||||
|
||||
std::sort(v.begin(),v.end(),less_by_employee_age());
|
||||
BOOST_CHECK(std::equal(i2.begin(),i2.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(i2.begin(),i2.end(),v.begin()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex basic test.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_basic.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_basic();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for capacity memfuns.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,7 +13,7 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -27,57 +27,57 @@ void test_capacity()
|
||||
es.insert(employee(3,"Albert",20,9012));
|
||||
es.insert(employee(4,"John",57,1002));
|
||||
|
||||
BOOST_CHECK(!es.empty());
|
||||
BOOST_CHECK(es.size()==5);
|
||||
BOOST_CHECK(es.size()<=es.max_size());
|
||||
BOOST_TEST(!es.empty());
|
||||
BOOST_TEST(es.size()==5);
|
||||
BOOST_TEST(es.size()<=es.max_size());
|
||||
|
||||
es.erase(es.begin());
|
||||
BOOST_CHECK(!get<name>(es).empty());
|
||||
BOOST_CHECK(get<name>(es).size()==4);
|
||||
BOOST_CHECK(get<name>(es).size()<=get<name>(es).max_size());
|
||||
BOOST_TEST(!get<name>(es).empty());
|
||||
BOOST_TEST(get<name>(es).size()==4);
|
||||
BOOST_TEST(get<name>(es).size()<=get<name>(es).max_size());
|
||||
|
||||
es.erase(es.begin());
|
||||
BOOST_CHECK(!get<as_inserted>(es).empty());
|
||||
BOOST_CHECK(get<as_inserted>(es).size()==3);
|
||||
BOOST_CHECK(get<as_inserted>(es).size()<=get<as_inserted>(es).max_size());
|
||||
BOOST_TEST(!get<as_inserted>(es).empty());
|
||||
BOOST_TEST(get<as_inserted>(es).size()==3);
|
||||
BOOST_TEST(get<as_inserted>(es).size()<=get<as_inserted>(es).max_size());
|
||||
|
||||
multi_index_container<int,indexed_by<sequenced<> > > ss;
|
||||
|
||||
ss.resize(10);
|
||||
BOOST_CHECK(ss.size()==10);
|
||||
BOOST_CHECK(ss.size()<=ss.max_size());
|
||||
BOOST_TEST(ss.size()==10);
|
||||
BOOST_TEST(ss.size()<=ss.max_size());
|
||||
|
||||
ss.resize(20);
|
||||
BOOST_CHECK(ss.size()==20);
|
||||
BOOST_TEST(ss.size()==20);
|
||||
|
||||
ss.resize(5);
|
||||
BOOST_CHECK(ss.size()==5);
|
||||
BOOST_TEST(ss.size()==5);
|
||||
|
||||
ss.resize(4);
|
||||
BOOST_CHECK(ss.size()==4);
|
||||
BOOST_TEST(ss.size()==4);
|
||||
|
||||
multi_index_container<int,indexed_by<random_access<> > > rs;
|
||||
|
||||
rs.resize(10);
|
||||
BOOST_CHECK(rs.size()==10);
|
||||
BOOST_CHECK(rs.size()<=rs.max_size());
|
||||
BOOST_CHECK(rs.size()<=rs.capacity());
|
||||
BOOST_TEST(rs.size()==10);
|
||||
BOOST_TEST(rs.size()<=rs.max_size());
|
||||
BOOST_TEST(rs.size()<=rs.capacity());
|
||||
|
||||
rs.resize(20);
|
||||
BOOST_CHECK(rs.size()==20);
|
||||
BOOST_CHECK(rs.size()<=rs.capacity());
|
||||
BOOST_TEST(rs.size()==20);
|
||||
BOOST_TEST(rs.size()<=rs.capacity());
|
||||
|
||||
unsigned int c=rs.capacity();
|
||||
rs.resize(5);
|
||||
BOOST_CHECK(rs.size()==5);
|
||||
BOOST_CHECK(rs.capacity()==c);
|
||||
BOOST_TEST(rs.size()==5);
|
||||
BOOST_TEST(rs.capacity()==c);
|
||||
|
||||
rs.reserve(100);
|
||||
BOOST_CHECK(rs.size()==5);
|
||||
BOOST_CHECK(rs.capacity()>=100);
|
||||
BOOST_TEST(rs.size()==5);
|
||||
BOOST_TEST(rs.capacity()>=100);
|
||||
|
||||
c=rs.capacity();
|
||||
rs.reserve(99);
|
||||
BOOST_CHECK(rs.size()==5);
|
||||
BOOST_CHECK(rs.capacity()==c);
|
||||
BOOST_TEST(rs.size()==5);
|
||||
BOOST_TEST(rs.capacity()==c);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for capacity memfuns.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,12 +8,12 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_capacity.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_capacity();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for comparison functions.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,7 +13,7 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -60,14 +60,14 @@ void test_comparison()
|
||||
es2.insert(employee(2,"John",40,7889));
|
||||
es2.insert(employee(3,"Albert",20,9012));
|
||||
|
||||
BOOST_CHECK(es==es&&es<=es&&es>=es&&
|
||||
BOOST_TEST(es==es&&es<=es&&es>=es&&
|
||||
i22==i22&&i22<=i22&&i22>=i22&&
|
||||
i32==i32&&i32<=i32&&i32>=i32&&
|
||||
i52==i52&&i52<=i52&&i52>=i52);
|
||||
BOOST_CHECK(es!=es2&&es2<es&&es>es2&&!(es<=es2)&&!(es2>=es));
|
||||
BOOST_CHECK(i2!=i22&&i22<i2&&i2>i22&&!(i2<=i22)&&!(i22>=i2));
|
||||
BOOST_CHECK(i3!=i32&&i32<i3&&i3>i32&&!(i3<=i32)&&!(i32>=i3));
|
||||
BOOST_CHECK(i5!=i52&&i52<i5&&i5>i52&&!(i5<=i52)&&!(i52>=i5));
|
||||
BOOST_TEST(es!=es2&&es2<es&&es>es2&&!(es<=es2)&&!(es2>=es));
|
||||
BOOST_TEST(i2!=i22&&i22<i2&&i2>i22&&!(i2<=i22)&&!(i22>=i2));
|
||||
BOOST_TEST(i3!=i32&&i32<i3&&i3>i32&&!(i3<=i32)&&!(i32>=i3));
|
||||
BOOST_TEST(i5!=i52&&i52<i5&&i5>i52&&!(i5<=i52)&&!(i52>=i5));
|
||||
|
||||
lookup_list<int>::type l1;
|
||||
lookup_list<char>::type l2;
|
||||
@ -103,15 +103,15 @@ void test_comparison()
|
||||
l5.push_back(long(5));
|
||||
l5.push_back(long(1));
|
||||
|
||||
BOOST_CHECK(l1==l2&&l1<=l2&&l1>=l2);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(l1==l2&&l1<=l2&&l1>=l2);
|
||||
BOOST_TEST(
|
||||
get<1>(l1)==get<1>(l2)&&get<1>(l1)<=get<1>(l2)&&get<1>(l1)>=get<1>(l2));
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
get<1>(l1)==get<1>(l3)&&get<1>(l1)<=get<1>(l3)&&get<1>(l1)>=get<1>(l3));
|
||||
BOOST_CHECK(l1!=l4&&l4<l1&&l1>l4);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(l1!=l4&&l4<l1&&l1>l4);
|
||||
BOOST_TEST(
|
||||
get<1>(l1)!=get<1>(l4)&&get<1>(l1)<get<1>(l4)&&get<1>(l4)>get<1>(l1));
|
||||
BOOST_CHECK(l3!=l5&&l5<l3&&l3>l5);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(l3!=l5&&l5<l3&&l3>l5);
|
||||
BOOST_TEST(
|
||||
get<1>(l3)!=get<1>(l5)&&get<1>(l3)<get<1>(l5)&&get<1>(l5)>get<1>(l3));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for comparison functions.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,12 +8,12 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_comparison.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_comparison();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for composite_key.
|
||||
*
|
||||
* Copyright 2003-2009 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -11,13 +11,13 @@
|
||||
#include "test_composite_key.hpp"
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/composite_key.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
using namespace boost::tuples;
|
||||
@ -374,22 +374,22 @@ void test_composite_key()
|
||||
mc1.insert(xyz(1,1,0));
|
||||
mc1.insert(xyz(1,1,1));
|
||||
|
||||
BOOST_CHECK(mc1.size()==8);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(mc1.size()==8);
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
mc1.find(mc1.key_extractor()(xyz(0,0,0))),
|
||||
mc1.find(mc1.key_extractor()(xyz(1,0,0))))==4);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
mc1.find(make_tuple(0,0,0)),
|
||||
mc1.find(make_tuple(1,0,0)))==4);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
mc1.lower_bound(make_tuple(0,0)),
|
||||
mc1.upper_bound(make_tuple(1,0)))==6);
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
mc1.lower_bound(1),
|
||||
mc1.upper_bound(1))==4);
|
||||
@ -409,20 +409,20 @@ void test_composite_key()
|
||||
get<2>(ck4.key_extractors())=
|
||||
get<2>(ck2.key_extractors());
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0))));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,1)),ck2(xyz(0,1,0))));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,0,0))));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0))));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,1)),ck2(xyz(0,1,0))));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,0,0))));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0)));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(1)));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(-1)));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0)));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,1)));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,-1)));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0)));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,1)));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,-1)));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0,1)));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0)));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(1)));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(-1)));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0)));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,1)));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,-1)));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0)));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,1)));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,-1)));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0,1)));
|
||||
|
||||
typedef composite_key_result_less<ckey_t1::result_type> ckey_comp_t1;
|
||||
typedef composite_key_result_equal_to<ckey_t1::result_type> ckey_eq_t1;
|
||||
@ -430,44 +430,44 @@ void test_composite_key()
|
||||
ckey_comp_t1 cp1;
|
||||
ckey_eq_t1 eq1;
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp1,eq1));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp1,eq1));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,0,0)),cp1,eq1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp1,eq1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp1,eq1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,0,0)),cp1,eq1));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0),cp1));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(1),cp1));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(-1),cp1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0),cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(1),cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(-1),cp1));
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),0,cp1));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),1,cp1));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),-1,cp1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),0,cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),1,cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),-1,cp1));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0),cp1));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,1),cp1));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,-1),cp1));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0),cp1,eq1));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,1),cp1,eq1));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,-1),cp1,eq1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0),cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,1),cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,-1),cp1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0),cp1,eq1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,1),cp1,eq1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,-1),cp1,eq1));
|
||||
|
||||
typedef composite_key_result_greater<ckey_t1::result_type> ckey_comp_t2;
|
||||
|
||||
ckey_comp_t2 cp2;
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp2));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp2));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,1)),ck2(xyz(0,0,0)),cp2));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,1)),ck2(xyz(0,0,0)),cp2));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0),cp2));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(1),cp2));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(-1),cp2));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0),cp2));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,1),cp2));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,-1),cp2));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0),cp2));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,1),cp2));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,-1),cp2));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(1),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(-1),cp2));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,1),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,-1),cp2));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,1),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,-1),cp2));
|
||||
|
||||
typedef composite_key_equal_to<
|
||||
modulo_equal,
|
||||
@ -490,31 +490,31 @@ void test_composite_key()
|
||||
eq3=eq4; /* prevent unused var */
|
||||
eq4=eq3; /* prevent unused var */
|
||||
|
||||
BOOST_CHECK( eq2(ck1(xyz(0,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(0,1,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(0,2,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK( eq2(ck1(xyz(0,3,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(1,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(1,1,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(1,2,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(1,3,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK( eq2(ck1(xyz(2,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(2,1,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(2,2,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK( eq2(ck1(xyz(2,3,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST( eq2(ck1(xyz(0,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(0,1,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(0,2,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST( eq2(ck1(xyz(0,3,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(1,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(1,1,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(1,2,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(1,3,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST( eq2(ck1(xyz(2,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(2,1,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(2,2,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST( eq2(ck1(xyz(2,3,0)),ck1(xyz(0,0,0))));
|
||||
|
||||
BOOST_CHECK( eq2(make_tuple(0,0,0),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(0,1,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_CHECK(!eq2(make_tuple(0,2,0),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK( eq2(ck1(xyz(0,3,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_CHECK(!eq2(make_tuple(1,0,0),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(1,1,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_CHECK(!eq2(make_tuple(1,2,0),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(1,3,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_CHECK( eq2(make_tuple(2,0,0),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK(!eq2(ck1(xyz(2,1,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_CHECK(!eq2(make_tuple(2,2,0),ck1(xyz(0,0,0))));
|
||||
BOOST_CHECK( eq2(ck1(xyz(2,3,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_TEST( eq2(make_tuple(0,0,0),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(0,1,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_TEST(!eq2(make_tuple(0,2,0),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST( eq2(ck1(xyz(0,3,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_TEST(!eq2(make_tuple(1,0,0),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(1,1,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_TEST(!eq2(make_tuple(1,2,0),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(1,3,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_TEST( eq2(make_tuple(2,0,0),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(2,1,0)) ,make_tuple(0,0,0)));
|
||||
BOOST_TEST(!eq2(make_tuple(2,2,0),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST( eq2(ck1(xyz(2,3,0)) ,make_tuple(0,0,0)));
|
||||
|
||||
typedef composite_key_compare<
|
||||
std::less<int>,
|
||||
@ -535,19 +535,19 @@ void test_composite_key()
|
||||
cp5=cp6; /* prevent unused var */
|
||||
cp6=cp4; /* prevent unused var */
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp3));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp3));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,0,0)),cp3));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,0,0)),cp3));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0),cp3));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(1),cp3));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(-1),cp3));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0),cp3));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,-1),cp3));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,1),cp3));
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0),cp3));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,1),cp3));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,-1),cp3));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0),cp3));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(1),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(-1),cp3));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0),cp3));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,-1),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,1),cp3));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),make_tuple(0,0,0),cp3));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),make_tuple(0,0,1),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),make_tuple(0,0,-1),cp3));
|
||||
|
||||
typedef composite_key<
|
||||
xyz,
|
||||
@ -557,21 +557,21 @@ void test_composite_key()
|
||||
|
||||
ckey_t2 ck5;
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0))));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0))));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0))));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0))));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0))));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0))));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp1));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp1));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp1));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp2));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp2));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp2));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp2));
|
||||
|
||||
BOOST_CHECK(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp3));
|
||||
BOOST_CHECK(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp3));
|
||||
BOOST_CHECK(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp3));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp3));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp3));
|
||||
|
||||
typedef multi_index_container<
|
||||
xyz,
|
||||
@ -604,9 +604,9 @@ void test_composite_key()
|
||||
mc2.insert(xyz(1,1,0));
|
||||
mc2.insert(xyz(1,1,1));
|
||||
|
||||
BOOST_CHECK(mc2.size()==8);
|
||||
BOOST_CHECK(mc2.find(make_tuple(0,0,1))->z==1);
|
||||
BOOST_CHECK(ck1(*(mc2.find(make_tuple(1,0,1))))==make_tuple(1,0,1));
|
||||
BOOST_TEST(mc2.size()==8);
|
||||
BOOST_TEST(mc2.find(make_tuple(0,0,1))->z==1);
|
||||
BOOST_TEST(ck1(*(mc2.find(make_tuple(1,0,1))))==make_tuple(1,0,1));
|
||||
|
||||
typedef composite_key<
|
||||
xystr,
|
||||
@ -636,10 +636,10 @@ void test_composite_key()
|
||||
ch3=ch4; /* prevent unused var */
|
||||
ch4=ch2; /* prevent unused var */
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(0,0,"hello")))==
|
||||
ch1(boost::make_tuple(std::string("hello"),0,0)));
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(4,5,"world")))==
|
||||
ch1(boost::make_tuple(std::string("world"),4,5)));
|
||||
|
||||
@ -647,8 +647,8 @@ void test_composite_key()
|
||||
|
||||
ckeyres_hash_t crh;
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(0,0,"hello")))==crh(ck6(xystr(0,0,"hello"))));
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(4,5,"world")))==crh(ck6(xystr(4,5,"world"))));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for composite_key.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_composite_key.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_composite_key();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Boost.MultiIndex test for interconvertibilty between const and
|
||||
* non-const iterators.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -14,7 +14,7 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -29,8 +29,8 @@ void test_conv_iterators()
|
||||
employee_set::const_iterator it1=es.find(employee(2,"John",40,7889));
|
||||
employee_set::const_iterator it2=ces.find(employee(2,"John",40,7889));
|
||||
|
||||
BOOST_CHECK(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_CHECK(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
BOOST_TEST(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_TEST(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
}
|
||||
{
|
||||
employee_set_by_name& i1=get<1>(es);
|
||||
@ -39,8 +39,8 @@ void test_conv_iterators()
|
||||
employee_set_by_name::const_iterator it1=i1.find("John");
|
||||
employee_set_by_name::const_iterator it2=ci1.find("John");
|
||||
|
||||
BOOST_CHECK(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_CHECK(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
BOOST_TEST(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_TEST(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
}
|
||||
{
|
||||
employee_set_by_name& i1=get<1>(es);
|
||||
@ -49,8 +49,8 @@ void test_conv_iterators()
|
||||
employee_set_by_name::const_local_iterator it1=i1.begin(i1.bucket("John"));
|
||||
employee_set_by_name::const_local_iterator it2=ci1.begin(ci1.bucket("John"));
|
||||
|
||||
BOOST_CHECK(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_CHECK(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
BOOST_TEST(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_TEST(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
}
|
||||
{
|
||||
employee_set_as_inserted& i3=get<3>(es);
|
||||
@ -59,8 +59,8 @@ void test_conv_iterators()
|
||||
employee_set_as_inserted::const_iterator it1=i3.begin();
|
||||
employee_set_as_inserted::const_iterator it2=ci3.begin();
|
||||
|
||||
BOOST_CHECK(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_CHECK(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
BOOST_TEST(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_TEST(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
}
|
||||
{
|
||||
employee_set_randomly& i5=get<5>(es);
|
||||
@ -69,7 +69,7 @@ void test_conv_iterators()
|
||||
employee_set_randomly::const_iterator it1=i5.begin();
|
||||
employee_set_randomly::const_iterator it2=ci5.begin();
|
||||
|
||||
BOOST_CHECK(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_CHECK(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
BOOST_TEST(it==it1&&it1==it2&&it2==it);
|
||||
BOOST_TEST(*it==*it1&&*it1==*it2&&*it2==*it);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Boost.MultiIndex test for interconvertibilty between const and
|
||||
* non-const iterators.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -9,13 +9,13 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_conv_iterators.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_conv_iterators();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for copying and assignment.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -17,7 +17,7 @@
|
||||
#include <vector>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -40,17 +40,17 @@ static void test_assign(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
|
||||
s.assign(&a[0],&a[sa]);
|
||||
|
||||
BOOST_CHECK(s.size()==sa&&std::equal(s.begin(),s.end(),&a[0]));
|
||||
BOOST_TEST(s.size()==sa&&std::equal(s.begin(),s.end(),&a[0]));
|
||||
|
||||
s.assign(&a[0],&a[sa]);
|
||||
|
||||
BOOST_CHECK(s.size()==sa&&std::equal(s.begin(),s.end(),&a[0]));
|
||||
BOOST_TEST(s.size()==sa&&std::equal(s.begin(),s.end(),&a[0]));
|
||||
|
||||
s.assign((std::size_t)18,37);
|
||||
BOOST_CHECK(s.size()==18&&std::accumulate(s.begin(),s.end(),0)==666);
|
||||
BOOST_TEST(s.size()==18&&std::accumulate(s.begin(),s.end(),0)==666);
|
||||
|
||||
s.assign((std::size_t)12,167);
|
||||
BOOST_CHECK(s.size()==12&&std::accumulate(s.begin(),s.end(),0)==2004);
|
||||
BOOST_TEST(s.size()==12&&std::accumulate(s.begin(),s.end(),0)==2004);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__,<=0x3003)
|
||||
@ -67,15 +67,15 @@ static void test_integral_assign(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
Sequence s;
|
||||
|
||||
s.assign(5,10);
|
||||
BOOST_CHECK(s.size()==5&&std::accumulate(s.begin(),s.end(),0)==50);
|
||||
BOOST_TEST(s.size()==5&&std::accumulate(s.begin(),s.end(),0)==50);
|
||||
s.assign(2u,5u);
|
||||
BOOST_CHECK(s.size()==2&&std::accumulate(s.begin(),s.end(),0)==10);
|
||||
BOOST_TEST(s.size()==2&&std::accumulate(s.begin(),s.end(),0)==10);
|
||||
|
||||
s.clear();
|
||||
s.insert(s.begin(),5,10);
|
||||
BOOST_CHECK(s.size()==5&&std::accumulate(s.begin(),s.end(),0)==50);
|
||||
BOOST_TEST(s.size()==5&&std::accumulate(s.begin(),s.end(),0)==50);
|
||||
s.insert(s.begin(),2u,5u);
|
||||
BOOST_CHECK(s.size()==7&&std::accumulate(s.begin(),s.end(),0)==60);
|
||||
BOOST_TEST(s.size()==7&&std::accumulate(s.begin(),s.end(),0)==60);
|
||||
}
|
||||
|
||||
void test_copy_assignment()
|
||||
@ -90,7 +90,7 @@ void test_copy_assignment()
|
||||
al=get<4>(es).get_allocator();
|
||||
al=get<5>(es).get_allocator();
|
||||
|
||||
BOOST_CHECK(es2.empty());
|
||||
BOOST_TEST(es2.empty());
|
||||
|
||||
es2.insert(employee(0,"Joe",31,1123));
|
||||
es2.insert(employee(1,"Robert",27,5601));
|
||||
@ -102,34 +102,34 @@ void test_copy_assignment()
|
||||
|
||||
employee_set es3(es2);
|
||||
|
||||
BOOST_CHECK(es2==es3);
|
||||
BOOST_CHECK(get<2>(es2)==get<2>(es3));
|
||||
BOOST_CHECK(get<3>(es2)==get<3>(es3));
|
||||
BOOST_CHECK(get<5>(es2)==get<5>(es3));
|
||||
BOOST_TEST(es2==es3);
|
||||
BOOST_TEST(get<2>(es2)==get<2>(es3));
|
||||
BOOST_TEST(get<3>(es2)==get<3>(es3));
|
||||
BOOST_TEST(get<5>(es2)==get<5>(es3));
|
||||
|
||||
employee_set es4=employee_set(non_std_allocator<employee>());
|
||||
employee_set_by_name& i1=get<name>(es4);
|
||||
i1=get<1>(es2);
|
||||
|
||||
BOOST_CHECK(es4==es2);
|
||||
BOOST_TEST(es4==es2);
|
||||
|
||||
employee_set es5;
|
||||
employee_set_by_age& i2=get<age>(es5);
|
||||
i2=get<2>(es2);
|
||||
|
||||
BOOST_CHECK(i2==get<2>(es2));
|
||||
BOOST_TEST(i2==get<2>(es2));
|
||||
|
||||
employee_set es6;
|
||||
employee_set_as_inserted& i3=get<as_inserted>(es6);
|
||||
i3=get<3>(es2);
|
||||
|
||||
BOOST_CHECK(i3==get<3>(es2));
|
||||
BOOST_TEST(i3==get<3>(es2));
|
||||
|
||||
employee_set es7;
|
||||
employee_set_randomly& i5=get<randomly>(es7);
|
||||
i5=get<5>(es2);
|
||||
|
||||
BOOST_CHECK(i5==get<5>(es2));
|
||||
BOOST_TEST(i5==get<5>(es2));
|
||||
|
||||
std::list<employee> l;
|
||||
l.push_back(employee(3,"Anna",31,5388));
|
||||
@ -145,7 +145,7 @@ void test_copy_assignment()
|
||||
|
||||
l.sort();
|
||||
|
||||
BOOST_CHECK(es8.size()==l.size()&&
|
||||
BOOST_TEST(es8.size()==l.size()&&
|
||||
std::equal(es8.begin(),es8.end(),l.begin()));
|
||||
|
||||
/* MSVC++ 6.0 chokes on test_assign without this explicit instantiation */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for copying and assignment.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_copy_assignment.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_copy_assignment();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for standard hash operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -12,12 +12,11 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <iterator>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/identity.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -27,8 +26,9 @@ template<typename HashedContainer>
|
||||
void check_load_factor(const HashedContainer& hc)
|
||||
{
|
||||
float lf=(float)hc.size()/hc.bucket_count();
|
||||
BOOST_CHECK_CLOSE(lf,hc.load_factor(),1.E-6f);
|
||||
BOOST_CHECK(lf<=hc.max_load_factor()+1.E-6);
|
||||
BOOST_TEST(lf<=hc.load_factor()+1.E-6);
|
||||
BOOST_TEST(lf>=hc.load_factor()-1.E-6);
|
||||
BOOST_TEST(lf<=hc.max_load_factor()+1.E-6);
|
||||
}
|
||||
|
||||
typedef multi_index_container<
|
||||
@ -42,14 +42,14 @@ void test_hash_ops()
|
||||
{
|
||||
hash_container hc;
|
||||
|
||||
BOOST_CHECK(hc.max_load_factor()==1.0f);
|
||||
BOOST_CHECK(hc.bucket_count()<=hc.max_bucket_count());
|
||||
BOOST_TEST(hc.max_load_factor()==1.0f);
|
||||
BOOST_TEST(hc.bucket_count()<=hc.max_bucket_count());
|
||||
|
||||
hc.insert(1000);
|
||||
hash_container::size_type buc=hc.bucket(1000);
|
||||
hash_container::local_iterator it0=hc.begin(buc);
|
||||
hash_container::local_iterator it1=hc.end(buc);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
(hash_container::size_type)std::distance(it0,it1)==hc.bucket_size(buc)&&
|
||||
hc.bucket_size(buc)==1&&*it0==1000);
|
||||
|
||||
@ -61,33 +61,33 @@ void test_hash_ops()
|
||||
check_load_factor(hc);
|
||||
|
||||
hc.max_load_factor(0.5f);
|
||||
BOOST_CHECK(hc.max_load_factor()==0.5f);
|
||||
BOOST_TEST(hc.max_load_factor()==0.5f);
|
||||
hc.insert(-1);
|
||||
check_load_factor(hc);
|
||||
|
||||
hc.rehash(1);
|
||||
BOOST_CHECK(hc.bucket_count()>=1);
|
||||
BOOST_TEST(hc.bucket_count()>=1);
|
||||
check_load_factor(hc);
|
||||
|
||||
hc.max_load_factor(0.25f);
|
||||
hc.rehash(1);
|
||||
BOOST_CHECK(hc.bucket_count()>=1);
|
||||
BOOST_TEST(hc.bucket_count()>=1);
|
||||
check_load_factor(hc);
|
||||
|
||||
hash_container::size_type bc=4*hc.bucket_count();
|
||||
hc.max_load_factor(0.125f);
|
||||
hc.rehash(bc);
|
||||
BOOST_CHECK(hc.bucket_count()>=bc);
|
||||
BOOST_TEST(hc.bucket_count()>=bc);
|
||||
check_load_factor(hc);
|
||||
|
||||
bc=2*hc.bucket_count();
|
||||
hc.rehash(bc);
|
||||
BOOST_CHECK(hc.bucket_count()>=bc);
|
||||
BOOST_TEST(hc.bucket_count()>=bc);
|
||||
check_load_factor(hc);
|
||||
|
||||
hc.clear();
|
||||
hc.insert(0);
|
||||
hc.rehash(1);
|
||||
BOOST_CHECK(hc.bucket_count()>=1);
|
||||
BOOST_TEST(hc.bucket_count()>=1);
|
||||
check_load_factor(hc);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for standard hash operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_hash_ops.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_hash_ops();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for iterators.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,8 +13,8 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -26,7 +26,7 @@ void test_non_const_iterators(Index& i,int target)
|
||||
|
||||
int n=0;
|
||||
for(iterator it=i.begin();it!=i.end();++it){
|
||||
BOOST_CHECK(i.iterator_to(*it)==it);
|
||||
BOOST_TEST(i.iterator_to(*it)==it);
|
||||
n+=it->id;
|
||||
}
|
||||
int m=0;
|
||||
@ -44,7 +44,7 @@ void test_non_const_iterators(Index& i,int target)
|
||||
q+=rit2->id;
|
||||
}
|
||||
|
||||
BOOST_CHECK(n==target&&n==m&&n==p&&n==q);
|
||||
BOOST_TEST(n==target&&n==m&&n==p&&n==q);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
@ -53,14 +53,14 @@ void test_const_iterators(const Index& i,int target)
|
||||
typedef typename Index::const_iterator const_iterator;
|
||||
typedef typename Index::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
BOOST_CHECK(i.cbegin()==i.begin());
|
||||
BOOST_CHECK(i.cend()==i.end());
|
||||
BOOST_CHECK(i.crbegin()==i.rbegin());
|
||||
BOOST_CHECK(i.crend()==i.rend());
|
||||
BOOST_TEST(i.cbegin()==i.begin());
|
||||
BOOST_TEST(i.cend()==i.end());
|
||||
BOOST_TEST(i.crbegin()==i.rbegin());
|
||||
BOOST_TEST(i.crend()==i.rend());
|
||||
|
||||
int n=0;
|
||||
for(const_iterator it=i.begin();it!=i.end();++it){
|
||||
BOOST_CHECK(i.iterator_to(*it)==it);
|
||||
BOOST_TEST(i.iterator_to(*it)==it);
|
||||
n+=it->id;
|
||||
}
|
||||
int m=0;
|
||||
@ -78,7 +78,7 @@ void test_const_iterators(const Index& i,int target)
|
||||
q+=rit2->id;
|
||||
}
|
||||
|
||||
BOOST_CHECK(n==target&&n==m&&n==p&&n==q);
|
||||
BOOST_TEST(n==target&&n==m&&n==p&&n==q);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
@ -90,18 +90,18 @@ void test_non_const_hashed_iterators(Index& i,int target)
|
||||
|
||||
int n=0;
|
||||
for(iterator it=i.begin();it!=i.end();++it){
|
||||
BOOST_CHECK(i.iterator_to(*it)==it);
|
||||
BOOST_TEST(i.iterator_to(*it)==it);
|
||||
n+=it->id;
|
||||
}
|
||||
int m=0;
|
||||
for(size_type buc=0;buc<i.bucket_count();++buc){
|
||||
for(local_iterator it=i.begin(buc);it!=i.end(buc);++it){
|
||||
BOOST_CHECK(i.local_iterator_to(*it)==it);
|
||||
BOOST_TEST(i.local_iterator_to(*it)==it);
|
||||
m+=it->id;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_CHECK(n==target&&n==m);
|
||||
BOOST_TEST(n==target&&n==m);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
@ -111,25 +111,25 @@ void test_const_hashed_iterators(const Index& i,int target)
|
||||
typedef typename Index::const_local_iterator const_local_iterator;
|
||||
typedef typename Index::size_type size_type;
|
||||
|
||||
BOOST_CHECK(i.cbegin()==i.begin());
|
||||
BOOST_CHECK(i.cend()==i.end());
|
||||
BOOST_TEST(i.cbegin()==i.begin());
|
||||
BOOST_TEST(i.cend()==i.end());
|
||||
|
||||
int n=0;
|
||||
for(const_iterator it=i.begin();it!=i.end();++it){
|
||||
BOOST_CHECK(i.iterator_to(*it)==it);
|
||||
BOOST_TEST(i.iterator_to(*it)==it);
|
||||
n+=it->id;
|
||||
}
|
||||
int m=0;
|
||||
for(size_type buc=0;buc<i.bucket_count();++buc){
|
||||
BOOST_CHECK(i.cbegin(buc)==i.begin(buc));
|
||||
BOOST_CHECK(i.cend(buc)==i.end(buc));
|
||||
BOOST_TEST(i.cbegin(buc)==i.begin(buc));
|
||||
BOOST_TEST(i.cend(buc)==i.end(buc));
|
||||
for(const_local_iterator it=i.begin(buc);it!=i.end(buc);++it){
|
||||
BOOST_CHECK(i.local_iterator_to(*it)==it);
|
||||
BOOST_TEST(i.local_iterator_to(*it)==it);
|
||||
m+=it->id;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_CHECK(n==target&&n==m);
|
||||
BOOST_TEST(n==target&&n==m);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
@ -146,7 +146,7 @@ void test_non_const_rnd_iterators(Index& i,int target)
|
||||
|
||||
int n=0;
|
||||
for(iterator it=i.begin();it!=middle;++it){
|
||||
BOOST_CHECK(i.iterator_to(*it)==it);
|
||||
BOOST_TEST(i.iterator_to(*it)==it);
|
||||
n+=it->id;
|
||||
n+=it[off].id;
|
||||
}
|
||||
@ -172,7 +172,7 @@ void test_non_const_rnd_iterators(Index& i,int target)
|
||||
}
|
||||
if(odd)q-=rmiddle->id;
|
||||
|
||||
BOOST_CHECK(n==target&&n==m&&n==p&&n==q);
|
||||
BOOST_TEST(n==target&&n==m&&n==p&&n==q);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
@ -182,10 +182,10 @@ void test_const_rnd_iterators(const Index& i,int target)
|
||||
typedef typename Index::const_reverse_iterator const_reverse_iterator;
|
||||
typedef typename Index::difference_type difference_type;
|
||||
|
||||
BOOST_CHECK(i.cbegin()==i.begin());
|
||||
BOOST_CHECK(i.cend()==i.end());
|
||||
BOOST_CHECK(i.crbegin()==i.rbegin());
|
||||
BOOST_CHECK(i.crend()==i.rend());
|
||||
BOOST_TEST(i.cbegin()==i.begin());
|
||||
BOOST_TEST(i.cend()==i.end());
|
||||
BOOST_TEST(i.crbegin()==i.rbegin());
|
||||
BOOST_TEST(i.crend()==i.rend());
|
||||
|
||||
const_iterator middle=i.begin()+(i.end()-i.begin())/2;
|
||||
difference_type off=middle-i.begin();
|
||||
@ -194,7 +194,7 @@ void test_const_rnd_iterators(const Index& i,int target)
|
||||
|
||||
int n=0;
|
||||
for(const_iterator it=i.begin();it!=middle;++it){
|
||||
BOOST_CHECK(i.iterator_to(*it)==it);
|
||||
BOOST_TEST(i.iterator_to(*it)==it);
|
||||
n+=it->id;
|
||||
n+=it[off].id;
|
||||
}
|
||||
@ -220,7 +220,7 @@ void test_const_rnd_iterators(const Index& i,int target)
|
||||
}
|
||||
if(odd)q-=rmiddle->id;
|
||||
|
||||
BOOST_CHECK(n==target&&n==m&&n==p&&n==q);
|
||||
BOOST_TEST(n==target&&n==m&&n==p&&n==q);
|
||||
}
|
||||
|
||||
void test_iterators()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for iterators.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,12 +8,12 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_iterators.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_iterators();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for key extractors.
|
||||
*
|
||||
* Copyright 2003-2009 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -11,11 +11,11 @@
|
||||
#include "test_key_extractors.hpp"
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index/key_extractors.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
@ -201,228 +201,228 @@ void test_key_extractors()
|
||||
boost::reference_wrapper<const test_class> ctw(tr);
|
||||
|
||||
id(tr).int_member=0;
|
||||
BOOST_CHECK(id(tr).int_member==0);
|
||||
BOOST_CHECK(cid(tr).int_member==0);
|
||||
BOOST_CHECK(k_m(tr)==0);
|
||||
BOOST_CHECK(ck_m(tr)==0);
|
||||
BOOST_CHECK(cmpk(tr)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_CHECK(ccmpk(tr)==make_tuple(test_class(0,0),0));
|
||||
BOOST_CHECK(id(ctr).int_member==0);
|
||||
BOOST_CHECK(cid(ctr).int_member==0);
|
||||
BOOST_CHECK(k_m(ctr)==0);
|
||||
BOOST_CHECK(ck_m(ctr)==0);
|
||||
BOOST_CHECK(cmpk(ctr)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_CHECK(ccmpk(ctr)==make_tuple(test_class(0,0),0));
|
||||
BOOST_TEST(id(tr).int_member==0);
|
||||
BOOST_TEST(cid(tr).int_member==0);
|
||||
BOOST_TEST(k_m(tr)==0);
|
||||
BOOST_TEST(ck_m(tr)==0);
|
||||
BOOST_TEST(cmpk(tr)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_TEST(ccmpk(tr)==make_tuple(test_class(0,0),0));
|
||||
BOOST_TEST(id(ctr).int_member==0);
|
||||
BOOST_TEST(cid(ctr).int_member==0);
|
||||
BOOST_TEST(k_m(ctr)==0);
|
||||
BOOST_TEST(ck_m(ctr)==0);
|
||||
BOOST_TEST(cmpk(ctr)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_TEST(ccmpk(ctr)==make_tuple(test_class(0,0),0));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(id(td).int_member==0);
|
||||
BOOST_CHECK(cid(td).int_member==0);
|
||||
BOOST_CHECK(k_m(td)==0);
|
||||
BOOST_CHECK(ck_m(td)==0);
|
||||
BOOST_CHECK(cmpk(td)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_CHECK(ccmpk(td)==make_tuple(test_class(0,0),0));
|
||||
BOOST_CHECK(id(ctdr).int_member==0);
|
||||
BOOST_CHECK(cid(ctdr).int_member==0);
|
||||
BOOST_CHECK(k_m(ctdr)==0);
|
||||
BOOST_CHECK(ck_m(ctdr)==0);
|
||||
BOOST_CHECK(cmpk(ctdr)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_CHECK(ccmpk(ctdr)==make_tuple(test_class(0,0),0));
|
||||
BOOST_TEST(id(td).int_member==0);
|
||||
BOOST_TEST(cid(td).int_member==0);
|
||||
BOOST_TEST(k_m(td)==0);
|
||||
BOOST_TEST(ck_m(td)==0);
|
||||
BOOST_TEST(cmpk(td)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_TEST(ccmpk(td)==make_tuple(test_class(0,0),0));
|
||||
BOOST_TEST(id(ctdr).int_member==0);
|
||||
BOOST_TEST(cid(ctdr).int_member==0);
|
||||
BOOST_TEST(k_m(ctdr)==0);
|
||||
BOOST_TEST(ck_m(ctdr)==0);
|
||||
BOOST_TEST(cmpk(ctdr)==make_tuple(test_class(0,0),0,0,true));
|
||||
BOOST_TEST(ccmpk(ctdr)==make_tuple(test_class(0,0),0));
|
||||
#endif
|
||||
|
||||
k_m(tr)=1;
|
||||
BOOST_CHECK(id(tp).int_member==1);
|
||||
BOOST_CHECK(cid(tp).int_member==1);
|
||||
BOOST_CHECK(k_m(tp)==1);
|
||||
BOOST_CHECK(ck_m(tp)==1);
|
||||
BOOST_CHECK(cmpk(tp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_CHECK(ccmpk(tp)==make_tuple(test_class(1,0),1));
|
||||
BOOST_CHECK(cid(ctp).int_member==1);
|
||||
BOOST_CHECK(ck_m(ctp)==1);
|
||||
BOOST_CHECK(cmpk(ctp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_CHECK(ccmpk(ctp)==make_tuple(test_class(1,0),1));
|
||||
BOOST_TEST(id(tp).int_member==1);
|
||||
BOOST_TEST(cid(tp).int_member==1);
|
||||
BOOST_TEST(k_m(tp)==1);
|
||||
BOOST_TEST(ck_m(tp)==1);
|
||||
BOOST_TEST(cmpk(tp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_TEST(ccmpk(tp)==make_tuple(test_class(1,0),1));
|
||||
BOOST_TEST(cid(ctp).int_member==1);
|
||||
BOOST_TEST(ck_m(ctp)==1);
|
||||
BOOST_TEST(cmpk(ctp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_TEST(ccmpk(ctp)==make_tuple(test_class(1,0),1));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(id(tdp).int_member==1);
|
||||
BOOST_CHECK(cid(tdp).int_member==1);
|
||||
BOOST_CHECK(k_m(tdp)==1);
|
||||
BOOST_CHECK(ck_m(tdp)==1);
|
||||
BOOST_CHECK(cmpk(tdp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_CHECK(ccmpk(tdp)==make_tuple(test_class(1,0),1));
|
||||
BOOST_CHECK(cid(ctdp).int_member==1);
|
||||
BOOST_CHECK(ck_m(ctdp)==1);
|
||||
BOOST_CHECK(cmpk(ctdp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_CHECK(ccmpk(ctdp)==make_tuple(test_class(1,0),1));
|
||||
BOOST_TEST(id(tdp).int_member==1);
|
||||
BOOST_TEST(cid(tdp).int_member==1);
|
||||
BOOST_TEST(k_m(tdp)==1);
|
||||
BOOST_TEST(ck_m(tdp)==1);
|
||||
BOOST_TEST(cmpk(tdp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_TEST(ccmpk(tdp)==make_tuple(test_class(1,0),1));
|
||||
BOOST_TEST(cid(ctdp).int_member==1);
|
||||
BOOST_TEST(ck_m(ctdp)==1);
|
||||
BOOST_TEST(cmpk(ctdp)==make_tuple(test_class(1,0),1,0,true));
|
||||
BOOST_TEST(ccmpk(ctdp)==make_tuple(test_class(1,0),1));
|
||||
#endif
|
||||
|
||||
k_m(tp)=2;
|
||||
BOOST_CHECK(id(tpp).int_member==2);
|
||||
BOOST_CHECK(cid(tpp).int_member==2);
|
||||
BOOST_CHECK(k_m(tpp)==2);
|
||||
BOOST_CHECK(ck_m(tpp)==2);
|
||||
BOOST_CHECK(cmpk(tpp)==make_tuple(test_class(2,0),2,0,true));
|
||||
BOOST_CHECK(ccmpk(tpp)==make_tuple(test_class(2,0),2));
|
||||
BOOST_CHECK(cid(ctpp).int_member==2);
|
||||
BOOST_CHECK(ck_m(ctpp)==2);
|
||||
BOOST_CHECK(cmpk(ctpp)==make_tuple(test_class(2,0),2,0,true));
|
||||
BOOST_CHECK(ccmpk(ctpp)==make_tuple(test_class(2,0),2));
|
||||
BOOST_TEST(id(tpp).int_member==2);
|
||||
BOOST_TEST(cid(tpp).int_member==2);
|
||||
BOOST_TEST(k_m(tpp)==2);
|
||||
BOOST_TEST(ck_m(tpp)==2);
|
||||
BOOST_TEST(cmpk(tpp)==make_tuple(test_class(2,0),2,0,true));
|
||||
BOOST_TEST(ccmpk(tpp)==make_tuple(test_class(2,0),2));
|
||||
BOOST_TEST(cid(ctpp).int_member==2);
|
||||
BOOST_TEST(ck_m(ctpp)==2);
|
||||
BOOST_TEST(cmpk(ctpp)==make_tuple(test_class(2,0),2,0,true));
|
||||
BOOST_TEST(ccmpk(ctpp)==make_tuple(test_class(2,0),2));
|
||||
|
||||
k_m(tpp)=3;
|
||||
BOOST_CHECK(id(tap).int_member==3);
|
||||
BOOST_CHECK(cid(tap).int_member==3);
|
||||
BOOST_CHECK(k_m(tap)==3);
|
||||
BOOST_CHECK(ck_m(tap)==3);
|
||||
BOOST_CHECK(cmpk(tap)==make_tuple(test_class(3,0),3,0,true));
|
||||
BOOST_CHECK(ccmpk(tap)==make_tuple(test_class(3,0),3));
|
||||
BOOST_CHECK(cid(ctap).int_member==3);
|
||||
BOOST_CHECK(ck_m(ctap)==3);
|
||||
BOOST_CHECK(cmpk(ctap)==make_tuple(test_class(3,0),3,0,true));
|
||||
BOOST_CHECK(ccmpk(ctap)==make_tuple(test_class(3,0),3));
|
||||
BOOST_TEST(id(tap).int_member==3);
|
||||
BOOST_TEST(cid(tap).int_member==3);
|
||||
BOOST_TEST(k_m(tap)==3);
|
||||
BOOST_TEST(ck_m(tap)==3);
|
||||
BOOST_TEST(cmpk(tap)==make_tuple(test_class(3,0),3,0,true));
|
||||
BOOST_TEST(ccmpk(tap)==make_tuple(test_class(3,0),3));
|
||||
BOOST_TEST(cid(ctap).int_member==3);
|
||||
BOOST_TEST(ck_m(ctap)==3);
|
||||
BOOST_TEST(cmpk(ctap)==make_tuple(test_class(3,0),3,0,true));
|
||||
BOOST_TEST(ccmpk(ctap)==make_tuple(test_class(3,0),3));
|
||||
|
||||
k_m(tap)=4;
|
||||
BOOST_CHECK(id(tw).int_member==4);
|
||||
BOOST_CHECK(cid(tw).int_member==4);
|
||||
BOOST_CHECK(k_m(tw)==4);
|
||||
BOOST_CHECK(ck_m(tw)==4);
|
||||
BOOST_CHECK(cmpk(tw)==make_tuple(test_class(4,0),4,0,true));
|
||||
BOOST_CHECK(ccmpk(tw)==make_tuple(test_class(4,0),4));
|
||||
BOOST_TEST(id(tw).int_member==4);
|
||||
BOOST_TEST(cid(tw).int_member==4);
|
||||
BOOST_TEST(k_m(tw)==4);
|
||||
BOOST_TEST(ck_m(tw)==4);
|
||||
BOOST_TEST(cmpk(tw)==make_tuple(test_class(4,0),4,0,true));
|
||||
BOOST_TEST(ccmpk(tw)==make_tuple(test_class(4,0),4));
|
||||
|
||||
k_m(tw)=5;
|
||||
BOOST_CHECK(id(ctw).int_member==5);
|
||||
BOOST_CHECK(cid(ctw).int_member==5);
|
||||
BOOST_CHECK(k_m(ctw)==5);
|
||||
BOOST_CHECK(ck_m(ctw)==5);
|
||||
BOOST_CHECK(cmpk(ctw)==make_tuple(test_class(5,0),5,0,true));
|
||||
BOOST_CHECK(ccmpk(ctw)==make_tuple(test_class(5,0),5));
|
||||
BOOST_TEST(id(ctw).int_member==5);
|
||||
BOOST_TEST(cid(ctw).int_member==5);
|
||||
BOOST_TEST(k_m(ctw)==5);
|
||||
BOOST_TEST(ck_m(ctw)==5);
|
||||
BOOST_TEST(cmpk(ctw)==make_tuple(test_class(5,0),5,0,true));
|
||||
BOOST_TEST(ccmpk(ctw)==make_tuple(test_class(5,0),5));
|
||||
|
||||
BOOST_CHECK(k_cm(tr)==0);
|
||||
BOOST_CHECK(k_cm(ctr)==0);
|
||||
BOOST_TEST(k_cm(tr)==0);
|
||||
BOOST_TEST(k_cm(ctr)==0);
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_cm(td)==0);
|
||||
BOOST_CHECK(k_cm(ctdr)==0);
|
||||
BOOST_TEST(k_cm(td)==0);
|
||||
BOOST_TEST(k_cm(ctdr)==0);
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_cm(tp)==0);
|
||||
BOOST_CHECK(k_cm(ctp)==0);
|
||||
BOOST_TEST(k_cm(tp)==0);
|
||||
BOOST_TEST(k_cm(ctp)==0);
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_cm(tdp)==0);
|
||||
BOOST_CHECK(k_cm(ctdp)==0);
|
||||
BOOST_TEST(k_cm(tdp)==0);
|
||||
BOOST_TEST(k_cm(ctdp)==0);
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_cm(tpp)==0);
|
||||
BOOST_CHECK(k_cm(ctpp)==0);
|
||||
BOOST_CHECK(k_cm(tap)==0);
|
||||
BOOST_CHECK(k_cm(ctap)==0);
|
||||
BOOST_TEST(k_cm(tpp)==0);
|
||||
BOOST_TEST(k_cm(ctpp)==0);
|
||||
BOOST_TEST(k_cm(tap)==0);
|
||||
BOOST_TEST(k_cm(ctap)==0);
|
||||
|
||||
BOOST_CHECK(k_cm(tw)==0);
|
||||
BOOST_CHECK(k_cm(ctw)==0);
|
||||
BOOST_TEST(k_cm(tw)==0);
|
||||
BOOST_TEST(k_cm(ctw)==0);
|
||||
|
||||
BOOST_CHECK(k_cmf(tr));
|
||||
BOOST_CHECK(k_cmf(ctr));
|
||||
BOOST_TEST(k_cmf(tr));
|
||||
BOOST_TEST(k_cmf(ctr));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_cmf(td));
|
||||
BOOST_CHECK(k_cmf(ctdr));
|
||||
BOOST_TEST(k_cmf(td));
|
||||
BOOST_TEST(k_cmf(ctdr));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_cmf(tp));
|
||||
BOOST_CHECK(k_cmf(ctp));
|
||||
BOOST_TEST(k_cmf(tp));
|
||||
BOOST_TEST(k_cmf(ctp));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_cmf(tdp));
|
||||
BOOST_CHECK(k_cmf(ctdp));
|
||||
BOOST_TEST(k_cmf(tdp));
|
||||
BOOST_TEST(k_cmf(ctdp));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_cmf(tpp));
|
||||
BOOST_CHECK(k_cmf(ctpp));
|
||||
BOOST_CHECK(k_cmf(tap));
|
||||
BOOST_CHECK(k_cmf(ctap));
|
||||
BOOST_TEST(k_cmf(tpp));
|
||||
BOOST_TEST(k_cmf(ctpp));
|
||||
BOOST_TEST(k_cmf(tap));
|
||||
BOOST_TEST(k_cmf(ctap));
|
||||
|
||||
BOOST_CHECK(k_cmf(tw));
|
||||
BOOST_CHECK(k_cmf(ctw));
|
||||
BOOST_TEST(k_cmf(tw));
|
||||
BOOST_TEST(k_cmf(ctw));
|
||||
|
||||
BOOST_CHECK(!k_mf(tr));
|
||||
BOOST_TEST(!k_mf(tr));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(!k_mf(td));
|
||||
BOOST_TEST(!k_mf(td));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(!k_mf(tp));
|
||||
BOOST_TEST(!k_mf(tp));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(!k_mf(tdp));
|
||||
BOOST_TEST(!k_mf(tdp));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(!k_mf(tpp));
|
||||
BOOST_CHECK(!k_mf(tap));
|
||||
BOOST_CHECK(!k_mf(tw));
|
||||
BOOST_TEST(!k_mf(tpp));
|
||||
BOOST_TEST(!k_mf(tap));
|
||||
BOOST_TEST(!k_mf(tw));
|
||||
|
||||
BOOST_CHECK(k_gf(tr));
|
||||
BOOST_CHECK(k_gf(ctr));
|
||||
BOOST_TEST(k_gf(tr));
|
||||
BOOST_TEST(k_gf(ctr));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_gf(td));
|
||||
BOOST_CHECK(k_gf(ctdr));
|
||||
BOOST_TEST(k_gf(td));
|
||||
BOOST_TEST(k_gf(ctdr));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_gf(tp));
|
||||
BOOST_CHECK(k_gf(ctp));
|
||||
BOOST_TEST(k_gf(tp));
|
||||
BOOST_TEST(k_gf(ctp));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_gf(tdp));
|
||||
BOOST_CHECK(k_gf(ctdp));
|
||||
BOOST_TEST(k_gf(tdp));
|
||||
BOOST_TEST(k_gf(ctdp));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_gf(tpp));
|
||||
BOOST_CHECK(k_gf(ctpp));
|
||||
BOOST_CHECK(k_gf(tap));
|
||||
BOOST_CHECK(k_gf(ctap));
|
||||
BOOST_TEST(k_gf(tpp));
|
||||
BOOST_TEST(k_gf(ctpp));
|
||||
BOOST_TEST(k_gf(tap));
|
||||
BOOST_TEST(k_gf(ctap));
|
||||
|
||||
BOOST_CHECK(k_gf(tw));
|
||||
BOOST_CHECK(k_gf(ctw));
|
||||
BOOST_TEST(k_gf(tw));
|
||||
BOOST_TEST(k_gf(ctw));
|
||||
|
||||
BOOST_CHECK(!k_gcrf(tr));
|
||||
BOOST_CHECK(!k_gcrf(ctr));
|
||||
BOOST_TEST(!k_gcrf(tr));
|
||||
BOOST_TEST(!k_gcrf(ctr));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(!k_gcrf(td));
|
||||
BOOST_CHECK(!k_gcrf(ctdr));
|
||||
BOOST_TEST(!k_gcrf(td));
|
||||
BOOST_TEST(!k_gcrf(ctdr));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(!k_gcrf(tp));
|
||||
BOOST_CHECK(!k_gcrf(ctp));
|
||||
BOOST_TEST(!k_gcrf(tp));
|
||||
BOOST_TEST(!k_gcrf(ctp));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(!k_gcrf(tdp));
|
||||
BOOST_CHECK(!k_gcrf(ctdp));
|
||||
BOOST_TEST(!k_gcrf(tdp));
|
||||
BOOST_TEST(!k_gcrf(ctdp));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(!k_gcrf(tpp));
|
||||
BOOST_CHECK(!k_gcrf(ctpp));
|
||||
BOOST_CHECK(!k_gcrf(tap));
|
||||
BOOST_CHECK(!k_gcrf(ctap));
|
||||
BOOST_TEST(!k_gcrf(tpp));
|
||||
BOOST_TEST(!k_gcrf(ctpp));
|
||||
BOOST_TEST(!k_gcrf(tap));
|
||||
BOOST_TEST(!k_gcrf(ctap));
|
||||
|
||||
BOOST_CHECK(!k_gcrf(tw));
|
||||
BOOST_CHECK(!k_gcrf(ctw));
|
||||
BOOST_TEST(!k_gcrf(tw));
|
||||
BOOST_TEST(!k_gcrf(ctw));
|
||||
|
||||
BOOST_CHECK(k_grf(tr));
|
||||
BOOST_TEST(k_grf(tr));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_grf(td));
|
||||
BOOST_TEST(k_grf(td));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_grf(tp));
|
||||
BOOST_TEST(k_grf(tp));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
BOOST_CHECK(k_grf(tdp));
|
||||
BOOST_TEST(k_grf(tdp));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(k_grf(tpp));
|
||||
BOOST_CHECK(k_grf(tap));
|
||||
BOOST_CHECK(k_grf(tw));
|
||||
BOOST_TEST(k_grf(tpp));
|
||||
BOOST_TEST(k_grf(tap));
|
||||
BOOST_TEST(k_grf(tw));
|
||||
|
||||
BOOST_CHECK(ccmpk_w(tw)==make_tuple(false));
|
||||
BOOST_TEST(ccmpk_w(tw)==make_tuple(false));
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
/* testcases for problems with non-copyable classes reported at
|
||||
@ -442,21 +442,21 @@ void test_key_extractors()
|
||||
test_nc_derived_class nc_td(-1,0);
|
||||
|
||||
nc_id(nc_td).int_member=0;
|
||||
BOOST_CHECK(nc_id(nc_td).int_member==0);
|
||||
BOOST_CHECK(nc_cid(nc_td).int_member==0);
|
||||
BOOST_TEST(nc_id(nc_td).int_member==0);
|
||||
BOOST_TEST(nc_cid(nc_td).int_member==0);
|
||||
|
||||
nc_k_m(&nc_td)=1;
|
||||
BOOST_CHECK(nc_k_m(&nc_td)==1);
|
||||
BOOST_CHECK(nc_ck_m(&nc_td)==1);
|
||||
BOOST_TEST(nc_k_m(&nc_td)==1);
|
||||
BOOST_TEST(nc_ck_m(&nc_td)==1);
|
||||
|
||||
BOOST_CHECK(nc_k_cmf(nc_td));
|
||||
BOOST_CHECK(!nc_k_mf(nc_td));
|
||||
BOOST_TEST(nc_k_cmf(nc_td));
|
||||
BOOST_TEST(!nc_k_mf(nc_td));
|
||||
|
||||
BOOST_CHECK(!nc_k_gcrf(nc_td));
|
||||
BOOST_CHECK(nc_k_grf(nc_td));
|
||||
BOOST_TEST(!nc_k_gcrf(nc_td));
|
||||
BOOST_TEST(nc_k_grf(nc_td));
|
||||
|
||||
test_nc_class nc_t(1,0);
|
||||
BOOST_CHECK(nc_cmpk(nc_td)==make_tuple(boost::cref(nc_t),1,1,true));
|
||||
BOOST_TEST(nc_cmpk(nc_td)==make_tuple(boost::cref(nc_t),1,1,true));
|
||||
#endif
|
||||
|
||||
std::list<test_class> tl;
|
||||
@ -464,15 +464,15 @@ void test_key_extractors()
|
||||
|
||||
int j=0;
|
||||
for(std::list<test_class>::iterator it=tl.begin();it!=tl.end();++it){
|
||||
BOOST_CHECK(k_m(it)==j);
|
||||
BOOST_CHECK(k_cm(it)==j);
|
||||
BOOST_CHECK(k_cmf(it));
|
||||
BOOST_CHECK(!k_mf(it));
|
||||
BOOST_CHECK(k_gf(it));
|
||||
BOOST_CHECK(!k_gcrf(it));
|
||||
BOOST_CHECK(k_grf(it));
|
||||
BOOST_CHECK(cmpk(it)==make_tuple(test_class(j),j,j,true));
|
||||
BOOST_CHECK(ccmpk(it)==make_tuple(test_class(j),j));
|
||||
BOOST_TEST(k_m(it)==j);
|
||||
BOOST_TEST(k_cm(it)==j);
|
||||
BOOST_TEST(k_cmf(it));
|
||||
BOOST_TEST(!k_mf(it));
|
||||
BOOST_TEST(k_gf(it));
|
||||
BOOST_TEST(!k_gcrf(it));
|
||||
BOOST_TEST(k_grf(it));
|
||||
BOOST_TEST(cmpk(it)==make_tuple(test_class(j),j,j,true));
|
||||
BOOST_TEST(ccmpk(it)==make_tuple(test_class(j),j));
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for key extractors.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_key_extractors.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_key_extractors();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for standard list operations.
|
||||
*
|
||||
* Copyright 2003-2010 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,6 +13,7 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/identity.hpp>
|
||||
@ -20,7 +21,6 @@
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
#include <boost/multi_index/random_access_index.hpp>
|
||||
#include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -29,12 +29,12 @@ using namespace boost::multi_index;
|
||||
{\
|
||||
int v[]={BOOST_PP_SEQ_ENUM(check_seq)};\
|
||||
std::size_t size_v=sizeof(v)/sizeof(int);\
|
||||
BOOST_CHECK(std::size_t(std::distance((p).begin(),(p).end()))==size_v);\
|
||||
BOOST_CHECK(std::equal((p).begin(),(p).end(),&v[0]));\
|
||||
BOOST_TEST(std::size_t(std::distance((p).begin(),(p).end()))==size_v);\
|
||||
BOOST_TEST(std::equal((p).begin(),(p).end(),&v[0]));\
|
||||
}
|
||||
|
||||
#undef CHECK_VOID_RANGE
|
||||
#define CHECK_VOID_RANGE(p) BOOST_CHECK((p).first==(p).second)
|
||||
#define CHECK_VOID_RANGE(p) BOOST_TEST((p).first==(p).second)
|
||||
|
||||
struct is_even
|
||||
{
|
||||
@ -110,7 +110,7 @@ static void test_list_ops_unique_seq(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
|
||||
si.splice(si.end(),si2,si2.begin());
|
||||
CHECK_EQUAL(si,(5)(1)(8)(4)(0)(2)(6)(3));
|
||||
BOOST_CHECK(si2.empty());
|
||||
BOOST_TEST(si2.empty());
|
||||
|
||||
si2.splice(si2.end(),si,project<1>(ss,ss.find(0)),project<1>(ss,ss.find(6)));
|
||||
CHECK_EQUAL(si,(5)(1)(8)(4)(6)(3));
|
||||
@ -124,12 +124,12 @@ static void test_list_ops_unique_seq(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
|
||||
si.sort();
|
||||
si2.sort();
|
||||
BOOST_CHECK(is_sorted(si,std::less<int>()));
|
||||
BOOST_CHECK(is_sorted(si2,std::less<int>()));
|
||||
BOOST_TEST(is_sorted(si,std::less<int>()));
|
||||
BOOST_TEST(is_sorted(si2,std::less<int>()));
|
||||
|
||||
si.merge(si2);
|
||||
BOOST_CHECK(is_sorted(si,std::less<int>()));
|
||||
BOOST_CHECK(si2.empty());
|
||||
BOOST_TEST(is_sorted(si,std::less<int>()));
|
||||
BOOST_TEST(si2.empty());
|
||||
|
||||
{
|
||||
Sequence ss3(ss);
|
||||
@ -137,15 +137,15 @@ static void test_list_ops_unique_seq(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
|
||||
si3.sort(std::greater<int>());
|
||||
si.reverse();
|
||||
BOOST_CHECK(si==si3);
|
||||
BOOST_TEST(si==si3);
|
||||
}
|
||||
|
||||
si2.splice(si2.end(),si,project<1>(ss,ss.find(6)),project<1>(ss,ss.find(3)));
|
||||
CHECK_EQUAL(si2,(6)(5)(4));
|
||||
|
||||
si.merge(si2,std::greater<int>());
|
||||
BOOST_CHECK(is_sorted(si,std::greater<int>()));
|
||||
BOOST_CHECK(si2.empty());
|
||||
BOOST_TEST(is_sorted(si,std::greater<int>()));
|
||||
BOOST_TEST(si2.empty());
|
||||
|
||||
/* testcase for bug reported at
|
||||
* https://svn.boost.org/trac/boost/ticket/3076
|
||||
@ -204,7 +204,7 @@ static void test_list_ops_non_unique_seq(
|
||||
ss2.push_back(0);
|
||||
ss.splice(ss.end(),ss2,ss2.begin());
|
||||
CHECK_EQUAL(ss,(0)(0));
|
||||
BOOST_CHECK(ss2.empty());
|
||||
BOOST_TEST(ss2.empty());
|
||||
|
||||
ss.clear();
|
||||
ss2.clear();
|
||||
@ -212,7 +212,7 @@ static void test_list_ops_non_unique_seq(
|
||||
ss2.push_back(0);
|
||||
ss.splice(ss.end(),ss2,ss2.begin(),ss2.end());
|
||||
CHECK_EQUAL(ss,(0)(0));
|
||||
BOOST_CHECK(ss2.empty());
|
||||
BOOST_TEST(ss2.empty());
|
||||
|
||||
ss.clear();
|
||||
ss2.clear();
|
||||
@ -220,7 +220,7 @@ static void test_list_ops_non_unique_seq(
|
||||
ss2.push_back(0);
|
||||
ss.merge(ss2);
|
||||
CHECK_EQUAL(ss,(0)(0));
|
||||
BOOST_CHECK(ss2.empty());
|
||||
BOOST_TEST(ss2.empty());
|
||||
|
||||
typedef typename Sequence::value_type value_type;
|
||||
ss.clear();
|
||||
@ -229,7 +229,7 @@ static void test_list_ops_non_unique_seq(
|
||||
ss2.push_back(0);
|
||||
ss.merge(ss2,std::less<value_type>());
|
||||
CHECK_EQUAL(ss,(0)(0));
|
||||
BOOST_CHECK(ss2.empty());
|
||||
BOOST_TEST(ss2.empty());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for standard list operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_list_ops.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_list_ops();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for modifier memfuns.
|
||||
*
|
||||
* Copyright 2003-2009 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -11,6 +11,7 @@
|
||||
#include "test_modifiers.hpp"
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@ -18,7 +19,6 @@
|
||||
#include <vector>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -115,88 +115,88 @@ void test_modifiers()
|
||||
employee_set_randomly& i5=get<randomly>(es);
|
||||
|
||||
es.insert(employee(0,"Joe",31,1123));
|
||||
BOOST_CHECK(es.insert(employee(0,"Joe",31,1123)).second==false);
|
||||
BOOST_CHECK(i1.insert(employee(0,"Joe Jr.",5,2563)).second==false);
|
||||
BOOST_CHECK(i2.insert(employee(1,"Victor",5,1123)).second==false);
|
||||
BOOST_CHECK(i3.insert(i3.begin(),employee(1,"Victor",5,1123)).second
|
||||
BOOST_TEST(es.insert(employee(0,"Joe",31,1123)).second==false);
|
||||
BOOST_TEST(i1.insert(employee(0,"Joe Jr.",5,2563)).second==false);
|
||||
BOOST_TEST(i2.insert(employee(1,"Victor",5,1123)).second==false);
|
||||
BOOST_TEST(i3.insert(i3.begin(),employee(1,"Victor",5,1123)).second
|
||||
==false);
|
||||
BOOST_CHECK(i3.push_front(employee(0,"Joe Jr.",5,2563)).second==false);
|
||||
BOOST_CHECK(i3.push_back(employee(0,"Joe Jr.",5,2563)).second==false);
|
||||
BOOST_TEST(i3.push_front(employee(0,"Joe Jr.",5,2563)).second==false);
|
||||
BOOST_TEST(i3.push_back(employee(0,"Joe Jr.",5,2563)).second==false);
|
||||
|
||||
employee_set_by_name::iterator it1=i1.find("Joe");
|
||||
i1.insert(it1,employee(1,"Joe Jr.",5,2563));
|
||||
BOOST_CHECK(es.size()==2);
|
||||
BOOST_TEST(es.size()==2);
|
||||
|
||||
employee_set_by_age::iterator it2=i2.find(31);
|
||||
i2.insert(it2,employee(2,"Grandda Joe",64,7881));
|
||||
BOOST_CHECK(es.size()==3);
|
||||
BOOST_TEST(es.size()==3);
|
||||
|
||||
employee_set_as_inserted::iterator it3=i3.begin();
|
||||
i3.insert(it3,100,employee(3,"Judy",39,6201));
|
||||
BOOST_CHECK((--it3)->ssn==6201);
|
||||
BOOST_CHECK(es.size()==4);
|
||||
BOOST_TEST((--it3)->ssn==6201);
|
||||
BOOST_TEST(es.size()==4);
|
||||
|
||||
employee_set_randomly::iterator it5=i5.begin();
|
||||
i5.insert(it5,100,employee(4,"Jill",52,3379));
|
||||
BOOST_CHECK(i5.begin()->age==52);
|
||||
BOOST_CHECK(es.size()==5);
|
||||
BOOST_TEST(i5.begin()->age==52);
|
||||
BOOST_TEST(es.size()==5);
|
||||
|
||||
es.erase(employee(1,"Joe Jr.",5,2563));
|
||||
BOOST_CHECK(i3.size()==4&&i5.size()==4);
|
||||
BOOST_TEST(i3.size()==4&&i5.size()==4);
|
||||
|
||||
BOOST_CHECK(i1.erase("Judy")==1);
|
||||
BOOST_CHECK(es.size()==3&&i2.size()==3);
|
||||
BOOST_TEST(i1.erase("Judy")==1);
|
||||
BOOST_TEST(es.size()==3&&i2.size()==3);
|
||||
|
||||
BOOST_CHECK(i2.erase(it2)->age==52);
|
||||
BOOST_CHECK(i3.size()==2&&i4.size()==2);
|
||||
BOOST_TEST(i2.erase(it2)->age==52);
|
||||
BOOST_TEST(i3.size()==2&&i4.size()==2);
|
||||
|
||||
i3.pop_front();
|
||||
BOOST_CHECK(i1.size()==1&&i2.size()==1);
|
||||
BOOST_TEST(i1.size()==1&&i2.size()==1);
|
||||
|
||||
i5.erase(i5.begin(),i5.end());
|
||||
BOOST_CHECK(es.size()==0&&i3.size()==0);
|
||||
BOOST_TEST(es.size()==0&&i3.size()==0);
|
||||
|
||||
es.insert(employee(0,"Joe",31,1123));
|
||||
BOOST_CHECK(i1.erase(i1.begin())==i1.end());
|
||||
BOOST_CHECK(i1.size()==0);
|
||||
BOOST_TEST(i1.erase(i1.begin())==i1.end());
|
||||
BOOST_TEST(i1.size()==0);
|
||||
|
||||
es.insert(employee(0,"Joe",31,1123));
|
||||
es.insert(employee(1,"Jack",31,5032));
|
||||
BOOST_CHECK(i2.erase(31)==2);
|
||||
BOOST_CHECK(i2.size()==0);
|
||||
BOOST_TEST(i2.erase(31)==2);
|
||||
BOOST_TEST(i2.size()==0);
|
||||
|
||||
i3.push_front(employee(1,"Jack",31,5032));
|
||||
i3.push_back(employee(0,"Joe",31,1123));
|
||||
BOOST_CHECK(i3.front()==employee(1,"Jack",31,5032));
|
||||
BOOST_CHECK(i3.back()==employee(0,"Joe",31,1123));
|
||||
BOOST_TEST(i3.front()==employee(1,"Jack",31,5032));
|
||||
BOOST_TEST(i3.back()==employee(0,"Joe",31,1123));
|
||||
|
||||
i3.pop_back();
|
||||
BOOST_CHECK(i3.back()==employee(1,"Jack",31,5032));
|
||||
BOOST_CHECK(es.size()==1);
|
||||
BOOST_TEST(i3.back()==employee(1,"Jack",31,5032));
|
||||
BOOST_TEST(es.size()==1);
|
||||
|
||||
i3.pop_front();
|
||||
BOOST_CHECK(es.size()==0);
|
||||
BOOST_TEST(es.size()==0);
|
||||
|
||||
i5.push_back(employee(1,"Jack",31,5032));
|
||||
i5.push_front(employee(0,"Joe",31,1123));
|
||||
i5.insert(i5.end()-1,employee(2,"Grandda Joe",64,7881));
|
||||
BOOST_CHECK(i5.back()==employee(1,"Jack",31,5032));
|
||||
BOOST_CHECK(i5.front()==employee(0,"Joe",31,1123));
|
||||
BOOST_CHECK(i5[0]==i5.front()&&i5.at(0)==i5.front());
|
||||
BOOST_CHECK(i5[i5.size()-1]==i5.back()&&i5.at(i5.size()-1)==i5.back());
|
||||
BOOST_TEST(i5.back()==employee(1,"Jack",31,5032));
|
||||
BOOST_TEST(i5.front()==employee(0,"Joe",31,1123));
|
||||
BOOST_TEST(i5[0]==i5.front()&&i5.at(0)==i5.front());
|
||||
BOOST_TEST(i5[i5.size()-1]==i5.back()&&i5.at(i5.size()-1)==i5.back());
|
||||
|
||||
i5.pop_front();
|
||||
BOOST_CHECK(i5.back()==employee(1,"Jack",31,5032));
|
||||
BOOST_CHECK(i5.front()==employee(2,"Grandda Joe",64,7881));
|
||||
BOOST_CHECK(es.size()==2);
|
||||
BOOST_TEST(i5.back()==employee(1,"Jack",31,5032));
|
||||
BOOST_TEST(i5.front()==employee(2,"Grandda Joe",64,7881));
|
||||
BOOST_TEST(es.size()==2);
|
||||
|
||||
i5.pop_back();
|
||||
BOOST_CHECK(i5.back()==employee(2,"Grandda Joe",64,7881));
|
||||
BOOST_CHECK(i5.front()==i5.front());
|
||||
BOOST_CHECK(es.size()==1);
|
||||
BOOST_TEST(i5.back()==employee(2,"Grandda Joe",64,7881));
|
||||
BOOST_TEST(i5.front()==i5.front());
|
||||
BOOST_TEST(es.size()==1);
|
||||
|
||||
i5.erase(i5.begin());
|
||||
BOOST_CHECK(es.size()==0);
|
||||
BOOST_TEST(es.size()==0);
|
||||
|
||||
std::vector<employee> ve;
|
||||
ve.push_back(employee(3,"Anna",31,5388));
|
||||
@ -204,36 +204,36 @@ void test_modifiers()
|
||||
ve.push_back(employee(2,"Agatha",40,1520));
|
||||
|
||||
i1.insert(ve.begin(),ve.end());
|
||||
BOOST_CHECK(i2.size()==3);
|
||||
BOOST_TEST(i2.size()==3);
|
||||
|
||||
BOOST_CHECK(i2.erase(i2.begin(),i2.end())==i2.end());
|
||||
BOOST_CHECK(es.size()==0);
|
||||
BOOST_TEST(i2.erase(i2.begin(),i2.end())==i2.end());
|
||||
BOOST_TEST(es.size()==0);
|
||||
|
||||
i2.insert(ve.begin(),ve.end());
|
||||
BOOST_CHECK(i3.size()==3);
|
||||
BOOST_TEST(i3.size()==3);
|
||||
|
||||
BOOST_CHECK(*(i3.erase(i3.begin()))==employee(1,"Rachel",27,9012));
|
||||
BOOST_CHECK(i3.erase(i3.begin(),i3.end())==i3.end());
|
||||
BOOST_CHECK(es.size()==0);
|
||||
BOOST_TEST(*(i3.erase(i3.begin()))==employee(1,"Rachel",27,9012));
|
||||
BOOST_TEST(i3.erase(i3.begin(),i3.end())==i3.end());
|
||||
BOOST_TEST(es.size()==0);
|
||||
|
||||
i3.insert(i3.end(),ve.begin(),ve.end());
|
||||
BOOST_CHECK(es.size()==3);
|
||||
BOOST_TEST(es.size()==3);
|
||||
|
||||
BOOST_CHECK(i4.erase(9012)==1);
|
||||
BOOST_TEST(i4.erase(9012)==1);
|
||||
i4.erase(i4.begin());
|
||||
BOOST_CHECK(i4.erase(i4.begin(),i4.end())==i4.end());
|
||||
BOOST_TEST(i4.erase(i4.begin(),i4.end())==i4.end());
|
||||
|
||||
i4.insert(ve.begin(),ve.end());
|
||||
BOOST_CHECK(i5.size()==3);
|
||||
BOOST_TEST(i5.size()==3);
|
||||
|
||||
BOOST_CHECK(i5.erase(i5.begin(),i5.end())==i5.end());
|
||||
BOOST_CHECK(es.size()==0);
|
||||
BOOST_TEST(i5.erase(i5.begin(),i5.end())==i5.end());
|
||||
BOOST_TEST(es.size()==0);
|
||||
|
||||
i5.insert(i5.begin(),ve.begin(),ve.end());
|
||||
BOOST_CHECK(i1.size()==3);
|
||||
BOOST_TEST(i1.size()==3);
|
||||
|
||||
BOOST_CHECK(es.erase(es.begin(),es.end())==es.end());
|
||||
BOOST_CHECK(i2.size()==0);
|
||||
BOOST_TEST(es.erase(es.begin(),es.end())==es.end());
|
||||
BOOST_TEST(i2.size()==0);
|
||||
|
||||
es.insert(employee(0,"Joe",31,1123));
|
||||
es.insert(employee(1,"Robert",27,5601));
|
||||
@ -251,19 +251,19 @@ void test_modifiers()
|
||||
employee_set es2_backup(es2);
|
||||
|
||||
i1.swap(get<1>(es2));
|
||||
BOOST_CHECK(es==es2_backup&&es2==es_backup);
|
||||
BOOST_TEST(es==es2_backup&&es2==es_backup);
|
||||
|
||||
i2.swap(get<2>(es2));
|
||||
BOOST_CHECK(es==es_backup&&es2==es2_backup);
|
||||
BOOST_TEST(es==es_backup&&es2==es2_backup);
|
||||
|
||||
i3.swap(get<3>(es2));
|
||||
BOOST_CHECK(es==es2_backup&&es2==es_backup);
|
||||
BOOST_TEST(es==es2_backup&&es2==es_backup);
|
||||
|
||||
i4.swap(get<4>(es2));
|
||||
BOOST_CHECK(es==es_backup&&es2==es2_backup);
|
||||
BOOST_TEST(es==es_backup&&es2==es2_backup);
|
||||
|
||||
i5.swap(get<5>(es2));
|
||||
BOOST_CHECK(es==es2_backup&&es2==es_backup);
|
||||
BOOST_TEST(es==es2_backup&&es2==es_backup);
|
||||
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
::boost::multi_index::detail::swap(i1,get<1>(es2));
|
||||
@ -272,7 +272,7 @@ void test_modifiers()
|
||||
swap(i1,get<1>(es2));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(es==es_backup&&es2==es2_backup);
|
||||
BOOST_TEST(es==es_backup&&es2==es2_backup);
|
||||
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
::boost::multi_index::detail::swap(i2,get<2>(es2));
|
||||
@ -281,7 +281,7 @@ void test_modifiers()
|
||||
swap(i2,get<2>(es2));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(es==es2_backup&&es2==es_backup);
|
||||
BOOST_TEST(es==es2_backup&&es2==es_backup);
|
||||
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
::boost::multi_index::detail::swap(i3,get<3>(es2));
|
||||
@ -290,7 +290,7 @@ void test_modifiers()
|
||||
swap(i3,get<3>(es2));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(es==es_backup&&es2==es2_backup);
|
||||
BOOST_TEST(es==es_backup&&es2==es2_backup);
|
||||
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
::boost::multi_index::detail::swap(i4,get<4>(es2));
|
||||
@ -299,7 +299,7 @@ void test_modifiers()
|
||||
swap(i4,get<4>(es2));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(es==es2_backup&&es2==es_backup);
|
||||
BOOST_TEST(es==es2_backup&&es2==es_backup);
|
||||
|
||||
#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
|
||||
::boost::multi_index::detail::swap(i5,get<5>(es2));
|
||||
@ -308,21 +308,21 @@ void test_modifiers()
|
||||
swap(i5,get<5>(es2));
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(es==es_backup&&es2==es2_backup);
|
||||
BOOST_TEST(es==es_backup&&es2==es2_backup);
|
||||
|
||||
i3.clear();
|
||||
BOOST_CHECK(i3.size()==0);
|
||||
BOOST_TEST(i3.size()==0);
|
||||
|
||||
es=es2;
|
||||
i4.clear();
|
||||
BOOST_CHECK(i4.size()==0);
|
||||
BOOST_TEST(i4.size()==0);
|
||||
|
||||
es=es2;
|
||||
i5.clear();
|
||||
BOOST_CHECK(i5.size()==0);
|
||||
BOOST_TEST(i5.size()==0);
|
||||
|
||||
es2.clear();
|
||||
BOOST_CHECK(es2.size()==0);
|
||||
BOOST_TEST(es2.size()==0);
|
||||
|
||||
/* testcase for problem reported at
|
||||
* http://lists.boost.org/boost-users/2006/12/24215.php
|
||||
@ -338,7 +338,7 @@ void test_modifiers()
|
||||
aoc.insert(always_one());
|
||||
aoc.insert(always_one());
|
||||
aoc.erase(*(aoc.begin()));
|
||||
BOOST_CHECK(aoc.empty());
|
||||
BOOST_TEST(aoc.empty());
|
||||
|
||||
/* Testcases for compliance with "as close to hint as possible"
|
||||
* proposed behavior for associative containers:
|
||||
@ -358,14 +358,14 @@ void test_modifiers()
|
||||
c.insert(1);c.insert(1);
|
||||
c.insert(2);c.insert(2);
|
||||
|
||||
BOOST_CHECK(std::distance(c.begin(),c.insert(c.begin(),1))==2);
|
||||
BOOST_CHECK(std::distance(c.begin(),c.insert(boost::next(c.begin()),1))==2);
|
||||
BOOST_CHECK(std::distance(c.begin(),c.insert(c.lower_bound(1),1))==2);
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(std::distance(c.begin(),c.insert(c.begin(),1))==2);
|
||||
BOOST_TEST(std::distance(c.begin(),c.insert(boost::next(c.begin()),1))==2);
|
||||
BOOST_TEST(std::distance(c.begin(),c.insert(c.lower_bound(1),1))==2);
|
||||
BOOST_TEST(
|
||||
std::distance(c.begin(),c.insert(boost::next(c.lower_bound(1)),1))==3);
|
||||
BOOST_CHECK(std::distance(c.begin(),c.insert(c.upper_bound(1),1))==8);
|
||||
BOOST_CHECK(std::distance(c.begin(),c.insert(boost::prior(c.end()),1))==9);
|
||||
BOOST_CHECK(std::distance(c.begin(),c.insert(c.end(),1))==10);
|
||||
BOOST_TEST(std::distance(c.begin(),c.insert(c.upper_bound(1),1))==8);
|
||||
BOOST_TEST(std::distance(c.begin(),c.insert(boost::prior(c.end()),1))==9);
|
||||
BOOST_TEST(std::distance(c.begin(),c.insert(c.end(),1))==10);
|
||||
|
||||
/* testcase for erase() reentrancy */
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for modifier memfuns.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,13 +8,13 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_modifiers.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_modifiers();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for for MPL operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_mpl_ops.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_mpl_ops();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for observer memfuns.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -15,7 +15,7 @@
|
||||
#include <vector>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -38,9 +38,9 @@ void test_observers()
|
||||
|
||||
employee_set_by_name::const_iterator it0=i1.equal_range("John").first;
|
||||
employee_set_by_name::const_iterator it1=it0;++it1;
|
||||
BOOST_CHECK(k(*it0)=="John"&&k(*it1)=="John");
|
||||
BOOST_CHECK(h(k(*it0))==h(k(*it1)));
|
||||
BOOST_CHECK(eq(k(*it0),k(*it1))==true);
|
||||
BOOST_TEST(k(*it0)=="John"&&k(*it1)=="John");
|
||||
BOOST_TEST(h(k(*it0))==h(k(*it1)));
|
||||
BOOST_TEST(eq(k(*it0),k(*it1))==true);
|
||||
}
|
||||
{
|
||||
employee_set_by_age::key_from_value k=i2.key_extractor();
|
||||
@ -49,8 +49,8 @@ void test_observers()
|
||||
|
||||
employee_set_by_age::const_iterator it0=i2.find(31);
|
||||
employee_set_by_age::const_iterator it1=i2.find(40);
|
||||
BOOST_CHECK(k(*it0)==31&&k(*it1)==40);
|
||||
BOOST_CHECK(c(k(*it0),k(*it1))==true);
|
||||
BOOST_CHECK(vc(*it0,*it1)==true);
|
||||
BOOST_TEST(k(*it0)==31&&k(*it1)==40);
|
||||
BOOST_TEST(c(k(*it0),k(*it1))==true);
|
||||
BOOST_TEST(vc(*it0,*it1)==true);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for observer memfuns.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_observers.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_observers();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for projection capabilities.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,7 +13,7 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -70,14 +70,14 @@ void test_projection()
|
||||
itbis=es.project<0>(it5);
|
||||
#endif
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
*it==*it1&&*it1==*it2&&*it2==*it3&&*it3==*it4&&*it4==*it5&&itbis==it);
|
||||
|
||||
BOOST_CHECK(project<name>(es,es.end())==get<name>(es).end());
|
||||
BOOST_CHECK(project<age>(es,es.end())==get<age>(es).end());
|
||||
BOOST_CHECK(project<as_inserted>(es,es.end())==get<as_inserted>(es).end());
|
||||
BOOST_CHECK(project<ssn>(es,es.end())==get<ssn>(es).end());
|
||||
BOOST_CHECK(project<randomly>(es,es.end())==get<randomly>(es).end());
|
||||
BOOST_TEST(project<name>(es,es.end())==get<name>(es).end());
|
||||
BOOST_TEST(project<age>(es,es.end())==get<age>(es).end());
|
||||
BOOST_TEST(project<as_inserted>(es,es.end())==get<as_inserted>(es).end());
|
||||
BOOST_TEST(project<ssn>(es,es.end())==get<ssn>(es).end());
|
||||
BOOST_TEST(project<randomly>(es,es.end())==get<randomly>(es).end());
|
||||
|
||||
const employee_set& ces=es;
|
||||
|
||||
@ -129,7 +129,7 @@ void test_projection()
|
||||
cit5= project<randomly>(ces,cit4);
|
||||
citbis=project<0>(ces,cit5);
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
*cit==*cit1&&*cit1==*cit2&&*cit2==*cit3&&*cit3==*cit4&&*cit4==*cit5&&
|
||||
citbis==cit);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for projection capabilities.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,13 +8,13 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_projection.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_projection();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for range().
|
||||
*
|
||||
* Copyright 2003-2010 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,12 +13,13 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/identity.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -30,12 +31,12 @@ typedef int_set::iterator int_set_iterator;
|
||||
{\
|
||||
int v[]={BOOST_PP_SEQ_ENUM(check_seq)};\
|
||||
std::size_t size_v=sizeof(v)/sizeof(int);\
|
||||
BOOST_CHECK(std::size_t(std::distance((p).first,(p).second))==size_v);\
|
||||
BOOST_CHECK(std::equal((p).first,(p).second,&v[0]));\
|
||||
BOOST_TEST(std::size_t(std::distance((p).first,(p).second))==size_v);\
|
||||
BOOST_TEST(std::equal((p).first,(p).second,&v[0]));\
|
||||
}
|
||||
|
||||
#undef CHECK_VOID_RANGE
|
||||
#define CHECK_VOID_RANGE(p) BOOST_CHECK((p).first==(p).second)
|
||||
#define CHECK_VOID_RANGE(p) BOOST_TEST((p).first==(p).second)
|
||||
|
||||
void test_range()
|
||||
{
|
||||
@ -102,17 +103,17 @@ void test_range()
|
||||
std::bind1st(std::less<int>(),7), /* 7 < x */
|
||||
std::bind2nd(std::less_equal<int>(),7)); /* x <= 7 */
|
||||
CHECK_VOID_RANGE(p);
|
||||
BOOST_CHECK(p.first==is.upper_bound(7));
|
||||
BOOST_TEST(p.first==is.upper_bound(7));
|
||||
|
||||
p=is.range(
|
||||
std::bind1st(std::less_equal<int>(),8), /* 8 <= x */
|
||||
std::bind2nd(std::less<int>(),2)); /* x < 2 */
|
||||
CHECK_VOID_RANGE(p);
|
||||
BOOST_CHECK(p.first==is.lower_bound(8));
|
||||
BOOST_TEST(p.first==is.lower_bound(8));
|
||||
|
||||
p=is.range(
|
||||
std::bind1st(std::less<int>(),4), /* 4 < x */
|
||||
std::bind2nd(std::less<int>(),5)); /* x < 5 */
|
||||
CHECK_VOID_RANGE(p);
|
||||
BOOST_CHECK(p.first!=is.end());
|
||||
BOOST_TEST(p.first!=is.end());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for range().
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_range.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_range();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for rearrange operations.
|
||||
*
|
||||
* Copyright 2003-2010 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,6 +13,7 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
@ -20,7 +21,6 @@
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
@ -30,12 +30,12 @@ using namespace boost::multi_index;
|
||||
{\
|
||||
int v[]={BOOST_PP_SEQ_ENUM(check_seq)};\
|
||||
std::size_t size_v=sizeof(v)/sizeof(int);\
|
||||
BOOST_CHECK(std::size_t(std::distance((p).begin(),(p).end()))==size_v);\
|
||||
BOOST_CHECK(std::equal((p).begin(),(p).end(),&v[0]));\
|
||||
BOOST_TEST(std::size_t(std::distance((p).begin(),(p).end()))==size_v);\
|
||||
BOOST_TEST(std::equal((p).begin(),(p).end(),&v[0]));\
|
||||
}
|
||||
|
||||
#undef CHECK_VOID_RANGE
|
||||
#define CHECK_VOID_RANGE(p) BOOST_CHECK((p).first==(p).second)
|
||||
#define CHECK_VOID_RANGE(p) BOOST_TEST((p).first==(p).second)
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__,<=0x3003)
|
||||
/* The "ISO C++ Template Parser" option makes CW8.3 incorrectly fail at
|
||||
@ -66,7 +66,7 @@ static void local_test_rearrange(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
std::advance(it,3);
|
||||
sc.relocate(sc.begin(),it);
|
||||
CHECK_EQUAL(sc,(3)(0)(1)(2)(4)(5));
|
||||
BOOST_CHECK(it==sc.begin());
|
||||
BOOST_TEST(it==sc.begin());
|
||||
|
||||
sc.relocate(it,it);
|
||||
CHECK_EQUAL(sc,(3)(0)(1)(2)(4)(5));
|
||||
@ -84,7 +84,7 @@ static void local_test_rearrange(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
++it2;
|
||||
sc.relocate(it2,it,sc.end());
|
||||
CHECK_EQUAL(sc,(3)(2)(4)(5)(0)(1));
|
||||
BOOST_CHECK(std::distance(it,it2)==3);
|
||||
BOOST_TEST(std::distance(it,it2)==3);
|
||||
|
||||
sc.relocate(boost::prior(sc.end()),it,it2);
|
||||
CHECK_EQUAL(sc,(3)(0)(2)(4)(5)(1));
|
||||
@ -95,19 +95,19 @@ static void local_test_rearrange(BOOST_EXPLICIT_TEMPLATE_TYPE(Sequence))
|
||||
}
|
||||
|
||||
sc.rearrange(v.begin());
|
||||
BOOST_CHECK(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
|
||||
std::reverse(v.begin(),v.end());
|
||||
sc.rearrange(v.begin());
|
||||
BOOST_CHECK(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
|
||||
std::sort(v.begin(),v.end());
|
||||
sc.rearrange(v.begin());
|
||||
BOOST_CHECK(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
|
||||
std::reverse(v.begin(),v.begin()+v.size()/2);
|
||||
sc.rearrange(v.begin());
|
||||
BOOST_CHECK(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
BOOST_TEST(std::equal(sc.begin(),sc.end(),v.begin()));
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__,<=0x3003)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for rearrange operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_rearrange.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_rearrange();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for safe_mode.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -15,7 +15,7 @@
|
||||
#include "employee.hpp"
|
||||
#include "pair_of_ints.hpp"
|
||||
#include <stdexcept>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -29,6 +29,8 @@ try{
|
||||
"safe mode violation not expected");\
|
||||
}
|
||||
|
||||
template<typename T> void prevent_unused_var_warning(const T&){}
|
||||
|
||||
template<typename Policy>
|
||||
static void local_test_safe_mode(
|
||||
std::forward_iterator_tag
|
||||
@ -69,21 +71,21 @@ static void local_test_safe_mode(
|
||||
iterator it;
|
||||
iterator it2;
|
||||
bool b=(it==it2);
|
||||
b=true; /* avoid warning about unused var */
|
||||
prevent_unused_var_warning(b);
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
iterator it=i.begin();
|
||||
iterator it2;
|
||||
bool b=(it==it2);
|
||||
b=true; /* avoid warning about unused var */
|
||||
prevent_unused_var_warning(b);
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
iterator it=i.begin();
|
||||
iterator it2=i2.begin();
|
||||
bool b=(it==it2);
|
||||
b=true; /* avoid warning about unused var */
|
||||
prevent_unused_var_warning(b);
|
||||
CATCH_SAFE_MODE(safe_mode::not_same_owner)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
@ -210,7 +212,7 @@ static void local_test_safe_mode(
|
||||
iterator it=i3.end();
|
||||
i3.clear();
|
||||
it=it;
|
||||
BOOST_CHECK(it==i3.end());
|
||||
BOOST_TEST(it==i3.end());
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +420,7 @@ static void test_integral_bimap(BOOST_EXPLICIT_TEMPLATE_TYPE(IntegralBimap))
|
||||
bm.insert(value_type(1,1));
|
||||
bm.modify(it,increment_first);
|
||||
value_type v=*it;
|
||||
v.first=0; /* avoid warning about unused var */
|
||||
prevent_unused_var_warning(v);
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
@ -427,7 +429,7 @@ static void test_integral_bimap(BOOST_EXPLICIT_TEMPLATE_TYPE(IntegralBimap))
|
||||
bm.insert(value_type(1,1));
|
||||
bm.modify(it,increment_second);
|
||||
pair_of_ints v=*it;
|
||||
v.first=0; /* avoid warning about unused var */
|
||||
prevent_unused_var_warning(v);
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for safe mode.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,12 +8,12 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_safe_mode.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_safe_mode();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for serialization, part 3.
|
||||
*
|
||||
* Copyright 2003-2010 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -131,16 +131,16 @@ void test_serialization3()
|
||||
std::istringstream iss(oss.str());
|
||||
boost::archive::text_iarchive ia(iss);
|
||||
ia>>hs2;
|
||||
BOOST_CHECK(boost::multi_index::get<1>(hs)==boost::multi_index::get<1>(hs2));
|
||||
BOOST_TEST(boost::multi_index::get<1>(hs)==boost::multi_index::get<1>(hs2));
|
||||
|
||||
for(int j=0;j<N;++j){
|
||||
iterator it;
|
||||
ia>>it;
|
||||
BOOST_CHECK(*it==j*SHUFFLE);
|
||||
BOOST_TEST(*it==j*SHUFFLE);
|
||||
}
|
||||
iterator it;
|
||||
ia>>it;
|
||||
BOOST_CHECK(it==hs2.end());
|
||||
BOOST_TEST(it==hs2.end());
|
||||
|
||||
for(std::size_t buc=0;buc<hs2.bucket_count();++buc){
|
||||
for(std::size_t k=0;k<hs2.bucket_size(buc);++k){
|
||||
@ -148,11 +148,11 @@ void test_serialization3()
|
||||
local_iterator it;
|
||||
ia>>n;
|
||||
ia>>it;
|
||||
BOOST_CHECK(*it==n);
|
||||
BOOST_TEST(*it==n);
|
||||
}
|
||||
local_iterator it2;
|
||||
ia>>it2;
|
||||
BOOST_CHECK(it2==hs2.end(buc));
|
||||
BOOST_TEST(it2==hs2.end(buc));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for serialization.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_serialization.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_serialization();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex serialization tests template.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -11,10 +11,10 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
@ -79,27 +79,27 @@ void test_serialization(const MultiIndexContainer& m)
|
||||
std::istringstream iss(oss.str());
|
||||
boost::archive::text_iarchive ia(iss);
|
||||
ia>>m2;
|
||||
BOOST_CHECK(all_indices_equal(m,m2));
|
||||
BOOST_TEST(all_indices_equal(m,m2));
|
||||
|
||||
iterator it_end=m2.end();
|
||||
for(iterator it=m2.begin();it!=it_end;++it){
|
||||
iterator it2;
|
||||
ia>>it2;
|
||||
BOOST_CHECK(it==it2);
|
||||
BOOST_TEST(it==it2);
|
||||
|
||||
/* exercise safe mode with this (unchecked) iterator */
|
||||
BOOST_CHECK(*it==*it2);
|
||||
BOOST_TEST(*it==*it2);
|
||||
m2.erase(it,it2);
|
||||
m2.erase(it2,it2);
|
||||
m2.erase(it2,it);
|
||||
iterator it3(++it2);
|
||||
iterator it4;
|
||||
it4=--it2;
|
||||
BOOST_CHECK(it==it4);
|
||||
BOOST_CHECK(it==boost::multi_index::project<0>(m2,it4));
|
||||
BOOST_TEST(it==it4);
|
||||
BOOST_TEST(it==boost::multi_index::project<0>(m2,it4));
|
||||
}
|
||||
iterator it2;
|
||||
ia>>it2;
|
||||
BOOST_CHECK(it_end==it2);
|
||||
BOOST_CHECK(it_end==boost::multi_index::project<0>(m2,it2));
|
||||
BOOST_TEST(it_end==it2);
|
||||
BOOST_TEST(it_end==boost::multi_index::project<0>(m2,it2));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for standard set operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -15,7 +15,7 @@
|
||||
#include <vector>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -32,27 +32,27 @@ void test_set_ops()
|
||||
es.insert(employee(3,"Albert",20,9012));
|
||||
es.insert(employee(4,"John",57,1002));
|
||||
|
||||
BOOST_CHECK(i1.find("John")->name=="John");
|
||||
BOOST_CHECK(i2.find(41)==i2.end());
|
||||
BOOST_CHECK(i4.find(5601)->name=="Robert");
|
||||
BOOST_TEST(i1.find("John")->name=="John");
|
||||
BOOST_TEST(i2.find(41)==i2.end());
|
||||
BOOST_TEST(i4.find(5601)->name=="Robert");
|
||||
|
||||
BOOST_CHECK(i1.count("John")==2);
|
||||
BOOST_CHECK(es.count(employee(10,"",-1,0))==0);
|
||||
BOOST_CHECK(i4.count(7881)==0);
|
||||
BOOST_TEST(i1.count("John")==2);
|
||||
BOOST_TEST(es.count(employee(10,"",-1,0))==0);
|
||||
BOOST_TEST(i4.count(7881)==0);
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
i2.lower_bound(31),
|
||||
i2.upper_bound(60))==3);
|
||||
|
||||
std::pair<employee_set_by_name::iterator,employee_set_by_name::iterator> p=
|
||||
i1.equal_range("John");
|
||||
BOOST_CHECK(std::distance(p.first,p.second)==2);
|
||||
BOOST_TEST(std::distance(p.first,p.second)==2);
|
||||
|
||||
p=i1.equal_range("Serena");
|
||||
BOOST_CHECK(p.first==i1.end()&&p.second==i1.end());
|
||||
BOOST_TEST(p.first==i1.end()&&p.second==i1.end());
|
||||
|
||||
std::pair<employee_set_by_age::iterator,employee_set_by_age::iterator> p2=
|
||||
i2.equal_range(30);
|
||||
BOOST_CHECK(p2.first==p2.second&&p2.first->age==31);
|
||||
BOOST_TEST(p2.first==p2.second&&p2.first->age==31);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for standard set operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_set_ops.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_set_ops();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for special set operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -15,7 +15,7 @@
|
||||
#include <sstream>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
|
||||
@ -75,21 +75,21 @@ void test_special_set_ops()
|
||||
get<ssn>(es).equal_range(
|
||||
"7889",hash_string_as_int(),eq_string_int());
|
||||
|
||||
BOOST_CHECK(std::distance(p.first,p.second)==1&&(p.first)->id==2);
|
||||
BOOST_TEST(std::distance(p.first,p.second)==1&&(p.first)->id==2);
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
get<ssn>(es).count(
|
||||
"5601",hash_string_as_int(),eq_string_int())==1);
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
get<ssn>(es).find(
|
||||
"1123",hash_string_as_int(),eq_string_int())->name=="Joe");
|
||||
|
||||
BOOST_CHECK(
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
get<age>(es).lower_bound("27",comp_int_string()),
|
||||
get<age>(es).upper_bound("40",comp_int_string()))==3);
|
||||
|
||||
BOOST_CHECK(es.count(2,employee::comp_id())==1);
|
||||
BOOST_CHECK(es.count(5,employee::comp_id())==0);
|
||||
BOOST_TEST(es.count(2,employee::comp_id())==1);
|
||||
BOOST_TEST(es.count(5,employee::comp_id())==0);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for special set operations.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_special_set_ops.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_special_set_ops();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for replace(), modify() and modify_key().
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -16,8 +16,8 @@
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
#include "pair_of_ints.hpp"
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
struct do_nothing
|
||||
{
|
||||
@ -47,13 +47,13 @@ void test_stable_update(BOOST_EXPLICIT_TEMPLATE_TYPE(MultiIndexContainer))
|
||||
iterator it=boost::next(c.begin(),n);
|
||||
|
||||
c.replace(it,*it);
|
||||
BOOST_CHECK((size_type)std::distance(c.begin(),it)==n);
|
||||
BOOST_TEST((size_type)std::distance(c.begin(),it)==n);
|
||||
|
||||
c.modify(it,do_nothing());
|
||||
BOOST_CHECK((size_type)std::distance(c.begin(),it)==n);
|
||||
BOOST_TEST((size_type)std::distance(c.begin(),it)==n);
|
||||
|
||||
c.modify(it,do_nothing(),do_nothing());
|
||||
BOOST_CHECK((size_type)std::distance(c.begin(),it)==n);
|
||||
BOOST_TEST((size_type)std::distance(c.begin(),it)==n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,12 +77,12 @@ void test_update()
|
||||
employee_set_randomly::iterator it2=
|
||||
project<randomly>(es,get<age>(es).find(57));
|
||||
|
||||
BOOST_CHECK(es.replace(it,*it));
|
||||
BOOST_CHECK(!es.replace(it,employee(3,"Joe",31,1123))&&it->id==0);
|
||||
BOOST_CHECK(es.replace(it,employee(0,"Joe",32,1123))&&it->age==32);
|
||||
BOOST_CHECK(i.replace(it1,employee(3,"Albert",20,9012))&&it1->name==
|
||||
BOOST_TEST(es.replace(it,*it));
|
||||
BOOST_TEST(!es.replace(it,employee(3,"Joe",31,1123))&&it->id==0);
|
||||
BOOST_TEST(es.replace(it,employee(0,"Joe",32,1123))&&it->age==32);
|
||||
BOOST_TEST(i.replace(it1,employee(3,"Albert",20,9012))&&it1->name==
|
||||
"Albert");
|
||||
BOOST_CHECK(!r.replace(it2,employee(4,"John",57,5601)));
|
||||
BOOST_TEST(!r.replace(it2,employee(4,"John",57,5601)));
|
||||
|
||||
{
|
||||
typedef multi_index_container<
|
||||
@ -100,63 +100,63 @@ void test_update()
|
||||
iis.insert(pair_of_ints(5,5));
|
||||
iis.insert(pair_of_ints(10,10));
|
||||
|
||||
BOOST_CHECK(!iis.replace(iis.begin(),pair_of_ints(5,0)));
|
||||
BOOST_CHECK(!ii2.replace(ii2.begin(),pair_of_ints(0,5)));
|
||||
BOOST_CHECK(!ii1.replace(project<1>(iis,iis.begin()),pair_of_ints(5,11)));
|
||||
BOOST_CHECK(!iis.replace(iis.begin(),pair_of_ints(11,5)));
|
||||
BOOST_CHECK(!iis.replace(boost::next(iis.begin()),pair_of_ints(10,5)));
|
||||
BOOST_CHECK(!ii1.replace(
|
||||
BOOST_TEST(!iis.replace(iis.begin(),pair_of_ints(5,0)));
|
||||
BOOST_TEST(!ii2.replace(ii2.begin(),pair_of_ints(0,5)));
|
||||
BOOST_TEST(!ii1.replace(project<1>(iis,iis.begin()),pair_of_ints(5,11)));
|
||||
BOOST_TEST(!iis.replace(iis.begin(),pair_of_ints(11,5)));
|
||||
BOOST_TEST(!iis.replace(boost::next(iis.begin()),pair_of_ints(10,5)));
|
||||
BOOST_TEST(!ii1.replace(
|
||||
project<1>(iis,boost::next(iis.begin())),pair_of_ints(5,10)));
|
||||
BOOST_CHECK(!iis.replace(boost::prior(iis.end()),pair_of_ints(5,10)));
|
||||
BOOST_CHECK(!ii2.replace(boost::prior(ii2.end()),pair_of_ints(10,5)));
|
||||
BOOST_TEST(!iis.replace(boost::prior(iis.end()),pair_of_ints(5,10)));
|
||||
BOOST_TEST(!ii2.replace(boost::prior(ii2.end()),pair_of_ints(10,5)));
|
||||
|
||||
BOOST_CHECK(iis.modify(iis.begin(),increment_first));
|
||||
BOOST_CHECK(ii2.modify(ii2.begin(),increment_first));
|
||||
BOOST_CHECK(ii1.modify(project<1>(iis,iis.begin()),increment_first));
|
||||
BOOST_CHECK(ii2.modify(ii2.begin(),increment_first,decrement_first));
|
||||
BOOST_TEST(iis.modify(iis.begin(),increment_first));
|
||||
BOOST_TEST(ii2.modify(ii2.begin(),increment_first));
|
||||
BOOST_TEST(ii1.modify(project<1>(iis,iis.begin()),increment_first));
|
||||
BOOST_TEST(ii2.modify(ii2.begin(),increment_first,decrement_first));
|
||||
|
||||
BOOST_CHECK(!iis.modify(iis.begin(),increment_first,decrement_first));
|
||||
BOOST_CHECK(iis.size()==3);
|
||||
BOOST_TEST(!iis.modify(iis.begin(),increment_first,decrement_first));
|
||||
BOOST_TEST(iis.size()==3);
|
||||
|
||||
BOOST_CHECK(!iis.modify(iis.begin(),increment_first));
|
||||
BOOST_CHECK(iis.size()==2);
|
||||
BOOST_TEST(!iis.modify(iis.begin(),increment_first));
|
||||
BOOST_TEST(iis.size()==2);
|
||||
|
||||
iis.insert(pair_of_ints(0,0));
|
||||
BOOST_CHECK(ii2.modify(boost::prior(ii2.end()),increment_second));
|
||||
BOOST_CHECK(iis.modify(iis.begin(),increment_second));
|
||||
BOOST_CHECK(ii2.modify(boost::prior(ii2.end()),increment_second));
|
||||
BOOST_CHECK(iis.modify(iis.begin(),increment_second,decrement_second));
|
||||
BOOST_TEST(ii2.modify(boost::prior(ii2.end()),increment_second));
|
||||
BOOST_TEST(iis.modify(iis.begin(),increment_second));
|
||||
BOOST_TEST(ii2.modify(boost::prior(ii2.end()),increment_second));
|
||||
BOOST_TEST(iis.modify(iis.begin(),increment_second,decrement_second));
|
||||
|
||||
BOOST_CHECK(!ii2.modify(
|
||||
BOOST_TEST(!ii2.modify(
|
||||
boost::prior(ii2.end()),increment_second,decrement_second));
|
||||
BOOST_CHECK(ii2.size()==3);
|
||||
BOOST_TEST(ii2.size()==3);
|
||||
|
||||
BOOST_CHECK(!ii2.modify(boost::prior(ii2.end()),increment_second));
|
||||
BOOST_CHECK(ii2.size()==2);
|
||||
BOOST_TEST(!ii2.modify(boost::prior(ii2.end()),increment_second));
|
||||
BOOST_TEST(ii2.size()==2);
|
||||
|
||||
iis.insert(pair_of_ints(0,0));
|
||||
BOOST_CHECK(iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_CHECK(iis.modify_key(iis.begin(),increment_int,decrement_int));
|
||||
BOOST_CHECK(iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_CHECK(iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_TEST(iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_TEST(iis.modify_key(iis.begin(),increment_int,decrement_int));
|
||||
BOOST_TEST(iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_TEST(iis.modify_key(iis.begin(),increment_int));
|
||||
|
||||
BOOST_CHECK(!iis.modify_key(iis.begin(),increment_int,decrement_int));
|
||||
BOOST_CHECK(iis.size()==3);
|
||||
BOOST_TEST(!iis.modify_key(iis.begin(),increment_int,decrement_int));
|
||||
BOOST_TEST(iis.size()==3);
|
||||
|
||||
BOOST_CHECK(!iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_CHECK(iis.size()==2);
|
||||
BOOST_TEST(!iis.modify_key(iis.begin(),increment_int));
|
||||
BOOST_TEST(iis.size()==2);
|
||||
|
||||
nth_index_iterator<int_int_set,1>::type it=ii1.find(5);
|
||||
BOOST_CHECK(ii1.modify_key(it,increment_int));
|
||||
BOOST_CHECK(ii1.modify_key(it,increment_int));
|
||||
BOOST_CHECK(ii1.modify_key(it,increment_int,decrement_int));
|
||||
BOOST_CHECK(ii1.modify_key(it,increment_int));
|
||||
BOOST_TEST(ii1.modify_key(it,increment_int));
|
||||
BOOST_TEST(ii1.modify_key(it,increment_int));
|
||||
BOOST_TEST(ii1.modify_key(it,increment_int,decrement_int));
|
||||
BOOST_TEST(ii1.modify_key(it,increment_int));
|
||||
|
||||
BOOST_CHECK(!ii1.modify_key(it,increment_int,decrement_int));
|
||||
BOOST_CHECK(ii1.size()==2);
|
||||
BOOST_TEST(!ii1.modify_key(it,increment_int,decrement_int));
|
||||
BOOST_TEST(ii1.size()==2);
|
||||
|
||||
BOOST_CHECK(!ii1.modify_key(it,increment_int));
|
||||
BOOST_CHECK(ii1.size()==1);
|
||||
BOOST_TEST(!ii1.modify_key(it,increment_int));
|
||||
BOOST_TEST(ii1.size()==1);
|
||||
}
|
||||
{
|
||||
typedef multi_index_container<
|
||||
@ -173,38 +173,38 @@ void test_update()
|
||||
int_int_set::iterator p2=iis.insert(pair_of_ints(5,5)).first;
|
||||
int_int_set::iterator p3=iis.insert(pair_of_ints(10,10)).first;
|
||||
|
||||
BOOST_CHECK(!iis.replace(p1,pair_of_ints(5,0)));
|
||||
BOOST_CHECK(!ii1.replace(ii1.begin(),pair_of_ints(0,5)));
|
||||
BOOST_CHECK(!iis.replace(p1,pair_of_ints(5,11)));
|
||||
BOOST_CHECK(!iis.replace(p1,pair_of_ints(11,5)));
|
||||
BOOST_CHECK(!iis.replace(p2,pair_of_ints(10,5)));
|
||||
BOOST_CHECK(!iis.replace(p2,pair_of_ints(5,10)));
|
||||
BOOST_CHECK(!iis.replace(p3,pair_of_ints(5,10)));
|
||||
BOOST_CHECK(!ii1.replace(boost::prior(ii1.end()),pair_of_ints(10,5)));
|
||||
BOOST_TEST(!iis.replace(p1,pair_of_ints(5,0)));
|
||||
BOOST_TEST(!ii1.replace(ii1.begin(),pair_of_ints(0,5)));
|
||||
BOOST_TEST(!iis.replace(p1,pair_of_ints(5,11)));
|
||||
BOOST_TEST(!iis.replace(p1,pair_of_ints(11,5)));
|
||||
BOOST_TEST(!iis.replace(p2,pair_of_ints(10,5)));
|
||||
BOOST_TEST(!iis.replace(p2,pair_of_ints(5,10)));
|
||||
BOOST_TEST(!iis.replace(p3,pair_of_ints(5,10)));
|
||||
BOOST_TEST(!ii1.replace(boost::prior(ii1.end()),pair_of_ints(10,5)));
|
||||
|
||||
BOOST_CHECK(iis.modify(p1,increment_first));
|
||||
BOOST_CHECK(ii1.modify(ii1.begin(),increment_first));
|
||||
BOOST_CHECK(iis.modify(p1,increment_first));
|
||||
BOOST_CHECK(ii1.modify(ii1.begin(),increment_first,decrement_first));
|
||||
BOOST_TEST(iis.modify(p1,increment_first));
|
||||
BOOST_TEST(ii1.modify(ii1.begin(),increment_first));
|
||||
BOOST_TEST(iis.modify(p1,increment_first));
|
||||
BOOST_TEST(ii1.modify(ii1.begin(),increment_first,decrement_first));
|
||||
|
||||
BOOST_CHECK(!iis.modify(p1,increment_first,decrement_first));
|
||||
BOOST_CHECK(iis.size()==3);
|
||||
BOOST_TEST(!iis.modify(p1,increment_first,decrement_first));
|
||||
BOOST_TEST(iis.size()==3);
|
||||
|
||||
BOOST_CHECK(!iis.modify(p1,increment_first));
|
||||
BOOST_CHECK(iis.size()==2);
|
||||
BOOST_TEST(!iis.modify(p1,increment_first));
|
||||
BOOST_TEST(iis.size()==2);
|
||||
|
||||
p1=iis.insert(pair_of_ints(0,0)).first;
|
||||
BOOST_CHECK(ii1.modify(boost::prior(ii1.end()),increment_second));
|
||||
BOOST_CHECK(iis.modify(p1,increment_second,decrement_second));
|
||||
BOOST_CHECK(ii1.modify(boost::prior(ii1.end()),increment_second));
|
||||
BOOST_CHECK(iis.modify(p1,increment_second));
|
||||
BOOST_TEST(ii1.modify(boost::prior(ii1.end()),increment_second));
|
||||
BOOST_TEST(iis.modify(p1,increment_second,decrement_second));
|
||||
BOOST_TEST(ii1.modify(boost::prior(ii1.end()),increment_second));
|
||||
BOOST_TEST(iis.modify(p1,increment_second));
|
||||
|
||||
BOOST_CHECK(!ii1.modify(
|
||||
BOOST_TEST(!ii1.modify(
|
||||
boost::prior(ii1.end()),increment_second,decrement_second));
|
||||
BOOST_CHECK(ii1.size()==3);
|
||||
BOOST_TEST(ii1.size()==3);
|
||||
|
||||
BOOST_CHECK(!ii1.modify(boost::prior(ii1.end()),increment_second));
|
||||
BOOST_CHECK(ii1.size()==2);
|
||||
BOOST_TEST(!ii1.modify(boost::prior(ii1.end()),increment_second));
|
||||
BOOST_TEST(ii1.size()==2);
|
||||
}
|
||||
{
|
||||
typedef multi_index_container<
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for replace(), modify() and modify_key().
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -8,11 +8,11 @@
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "test_update.hpp"
|
||||
|
||||
int test_main(int,char *[])
|
||||
int main()
|
||||
{
|
||||
test_update();
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user