#ifndef BOOST_CONTAINER_TEST_CONTAINER_COMMON_TESTS_HPP
#define BOOST_CONTAINER_TEST_CONTAINER_COMMON_TESTS_HPP
#include <boost/container/detail/config_begin.hpp>
namespace boost{
namespace container {
namespace test{
template<class Container>
const Container &as_const(Container &c)
{ return c; }
template<class Container>
bool test_nth_index_of(Container &c)
{
typename Container::iterator it;
typename Container::const_iterator cit;
typename Container::size_type sz, csz;
typedef typename Container::difference_type difference_type;
it = c.nth(0);
sz = c.index_of(it);
cit = (as_const)(c).nth(0);
csz = (as_const)(c).index_of(cit);
if(it != c.begin())
return false;
if(cit != c.cbegin())
return false;
if(sz != 0)
return false;
if(csz != 0)
return false;
const typename Container::size_type sz_div_2 = c.size()/2;
it = c.nth(sz_div_2);
sz = c.index_of(it);
cit = (as_const)(c).nth(sz_div_2);
csz = (as_const)(c).index_of(cit);
if(it != (c.begin()+difference_type(sz_div_2)))
return false;
if(cit != (c.cbegin()+difference_type(sz_div_2)))
return false;
if(sz != sz_div_2)
return false;
if(csz != sz_div_2)
return false;
it = c.nth(c.size());
sz = c.index_of(it);
cit = (as_const)(c).nth(c.size());
csz = (as_const)(c).index_of(cit);
if(it != c.end())
return false;
if(cit != c.cend())
return false;
if(sz != c.size())
return false;
if(csz != c.size())
return false;
return true;
}
} } }
#include <boost/container/detail/config_end.hpp>
#endif