|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54275 - in sandbox/monotonic: boost/monotonic/container libs/monotonic/test/Tests
From: christian.schladetsch_at_[hidden]
Date: 2009-06-23 04:29:28
Author: cschladetsch
Date: 2009-06-23 04:29:27 EDT (Tue, 23 Jun 2009)
New Revision: 54275
URL: http://svn.boost.org/trac/boost/changeset/54275
Log:
more tests
Text files modified:
sandbox/monotonic/boost/monotonic/container/list.hpp | 10 +++++++---
sandbox/monotonic/boost/monotonic/container/vector.hpp | 10 ++++++++--
sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp | 32 +++++++++++++++++++++++++++++---
3 files changed, 44 insertions(+), 8 deletions(-)
Modified: sandbox/monotonic/boost/monotonic/container/list.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/list.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/list.hpp 2009-06-23 04:29:27 EDT (Tue, 23 Jun 2009)
@@ -112,13 +112,17 @@
template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
bool operator==(list<Ty,R,Acc> const &A, list<Ty2,R2,Acc2> const &B)
{
- return A.get_impl() == B.get_impl();
+ return A.size() == B.size() && std::equal(A.begin(), A.end(), B.begin());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator!=(list<Ty,R,Acc> const &A, list<Ty2,R2,Acc2> const &B)
+ {
+ return !(A == B);
}
-
template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
bool operator<(list<Ty,R,Acc> const &A, list<Ty2,R2,Acc2> const &B)
{
- return A.get_impl() < B.get_impl();
+ return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end());
}
} // namespace monotonic
Modified: sandbox/monotonic/boost/monotonic/container/vector.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/container/vector.hpp (original)
+++ sandbox/monotonic/boost/monotonic/container/vector.hpp 2009-06-23 04:29:27 EDT (Tue, 23 Jun 2009)
@@ -140,13 +140,19 @@
template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
bool operator==(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
{
- return A.get_impl() == B.get_impl();
+ return A.size() == B.size() && std::equal(A.begin(), A.end(), B.begin());
+ }
+ template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
+ bool operator!=(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
+ {
+ return !(A == B);
}
template <class Ty,class R,class Acc,class Ty2,class R2,class Acc2>
bool operator<(vector<Ty,R,Acc> const &A, vector<Ty2,R2,Acc2> const &B)
{
- return A.get_impl() < B.get_impl();
+ return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end());
+
}
} // namespace monotonic
Modified: sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp 2009-06-23 04:29:27 EDT (Tue, 23 Jun 2009)
@@ -58,9 +58,22 @@
{
monotonic::vector<int> vec;
vec.resize(100);
+ fill_n(vec.begin(), 100, 42);
monotonic::vector<int, region1> vec2;
vec2.resize(100);
+ fill_n(vec2.begin(), 100, 42);
+
+ BOOST_ASSERT(vec == vec2);
+ BOOST_ASSERT(!(vec2 != vec));
+ BOOST_ASSERT(!(vec < vec2));
+ BOOST_ASSERT(!(vec2 < vec));
+
+ vec2[0] = 40;
+ BOOST_ASSERT(vec2 != vec);
+ BOOST_ASSERT(vec2 < vec);
+ BOOST_ASSERT(!(vec < vec2));
+
monotonic::static_storage<>::reset();
monotonic::static_storage<region1>::reset();
@@ -74,6 +87,14 @@
monotonic::list<int, region1> cont2;
fill_n(back_inserter(cont2), 100, 42);
+ BOOST_ASSERT(cont == cont2);
+ BOOST_ASSERT(!(cont != cont2));
+ BOOST_ASSERT(!(cont < cont2));
+ cont.front() = 5;
+ BOOST_ASSERT(cont2 != cont);
+ BOOST_ASSERT(cont < cont2);
+ BOOST_ASSERT(!(cont2 < cont));
+
monotonic::static_storage<>::reset();
monotonic::static_storage<region1>::reset();
}
@@ -100,12 +121,17 @@
typedef std::list<int, monotonic::allocator<int, region0, monotonic::shared_access_tag> > List0;
List0 list0;
- // same thing, less typing:
+ typedef std::list<int, monotonic::allocator<int, region0, monotonic::thread_local_access_tag> > List1;
+ List1 list1;
+
+ // same thing
typedef std::list<int, monotonic::shared_allocator<int, region0> > List2;
List2 list2;
- typedef std::list<int, monotonic::allocator<int, region0, monotonic::thread_local_access_tag> > List1;
- List1 list1;
+ // same again
+ typedef monotonic::list<int, region0, monotonic::shared_access_tag> List3;
+ List3 list3;
+
}
BOOST_AUTO_TEST_CASE(test_regional_allocation)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk