5# include <unordered_map>
6# include <unordered_set>
13#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
16using namespace std::tr1;
39#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
91 usettype::local_iterator lit, litEnd;
93 lit =
us.begin(
us.bucket(
i));
94 litEnd =
us.end(
us.bucket(
i));
96 usettype::size_type bucket_pos =
us.bucket(*lit);
97 for (; lit != litEnd; ++lit) {
99 us_val.push_back(*lit);
109 sort(us_val.begin(), us_val.end());
123 usettype::iterator
ret;
135 usettype::local_iterator lit, litEnd;
137 lit =
us.begin(
us.bucket(
i));
138 litEnd =
us.end(
us.bucket(
i));
140 usettype::size_type bucket_pos =
us.bucket(*lit);
141 for (; lit != litEnd; ++lit) {
143 us_val.push_back(*lit);
147 sort(us_val.begin(), us_val.end());
170 umaptype
const& uref = uus[0];
171 umaptype ucopy = uus[0];
180 umaptype::value_type p1(
i,
i);
185 umaptype::value_type p2(
i,
i + 1);
193 umaptype::iterator umit;
203 vector<pair<int, int> > us_val;
205 umaptype::local_iterator lit, litEnd;
207 lit =
us.begin(
us.bucket(
i));
208 litEnd =
us.end(
us.bucket(
i));
210 umaptype::size_type bucket_pos =
us.bucket((*lit).first);
211 for (; lit != litEnd; ++lit) {
213 us_val.push_back(
make_pair((*lit).first, (*lit).second));
217 sort(us_val.begin(), us_val.end());
231 umaptype::iterator
ret;
233 umaptype::value_type
p(
i,
i);
243 vector<ptype> us_val;
245 umaptype::local_iterator lit, litEnd;
247 lit =
us.begin(
us.bucket(
i));
248 litEnd =
us.end(
us.bucket(
i));
250 umaptype::size_type bucket_pos =
us.bucket((*lit).first);
251 for (; lit != litEnd; ++lit) {
253 us_val.push_back(ptype((*lit).first, (*lit).second));
257 sort(us_val.begin(), us_val.end());
275 foo.insert(UnorderedMap1::value_type(1,
string(
"test1")));
276 foo.insert(UnorderedMap1::value_type(2,
string(
"test2")));
277 foo.insert(UnorderedMap1::value_type(3,
string(
"test3")));
278 foo.insert(UnorderedMap1::value_type(4,
string(
"test4")));
279 foo.insert(UnorderedMap1::value_type(5,
string(
"test5")));
281 bar.insert(UnorderedMap2::value_type(0,
foo));
282 UnorderedMap2::iterator it =
bar.find(0);
285 UnorderedMap1 &
body = it->second;
286 UnorderedMap1::iterator
cur =
body.find(3);
303 for (
int i = 0; (
size_t)
i < nbInserts; ++
i) {
313 int_uset.
rehash(bucketsHint);
331 for (
i = 0; (
size_t)
i < nbInserts; ++
i) {
336 size_t bucketSizes = 0;
337 for (
i = 0; (
size_t)
i < nbBuckets; ++
i) {
353 size_t nbBuckets = iumset.bucket_count();
355 for (
size_t i = 0;
i < nbBuckets; ++
i) {
357 iumset.insert(
i + nbBuckets);
358 iumset.insert(
i + 2 * nbBuckets);
359 iumset.insert(
i + 3 * nbBuckets);
360 iumset.insert(
i + 4 * nbBuckets);
369 size_t nbElems = iumset.size();
371 for (umset::iterator
j =
p.first;
j !=
p.second;) {
377 p = iumset.equal_range(2);
380 iumset.erase(
p.first,
p.second);
393 size_t nbBuckets = iumset.bucket_count();
394 const size_t targetedBucket = nbBuckets / 2;
397 for (
i = 0;
i < 10; ++
i) {
398 iumset.insert(targetedBucket + (
i * nbBuckets));
402 for (
i = 9;
i <= 10; --
i) {
403 iumset.insert(targetedBucket + (
i * nbBuckets));
408 while (iumset.bucket_count() == nbBuckets) {
419 nbBuckets = iumset.bucket_count();
420 while (iumset.bucket_count() == nbBuckets &&
422 iumset.erase(iumset.begin());
424 CPPUNIT_ASSERT( iumset.load_factor() <= iumset.max_load_factor() );
427 nbBuckets = iumset.bucket_count();
434 for (
int runs = 0; runs < 2; ++runs) {
435 size_t magic =
rand();
438 for (
int i = 0;
i < 10000; ++
i) {
439 if ((
rand() % 500) == 0) {
445 while ((
r =
rand()) == magic)
481 const size_t target = 500000;
500 const size_t target = 500000;
529 {
return (
size_t)
key.m_data; }
532 {
return (
size_t)
data; }
541 {
return lhs.
m_data == rhs; }
544 {
return lhs == rhs.
m_data; }
550 {
return (
size_t)
key->m_data; }
553 {
return (
size_t)
data; }
562 {
return lhs->
m_data == rhs; }
565 {
return lhs == rhs->
m_data; }
570#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION)
586 Container
const& ccont = cont;
595 Key key1(1), key2(2), key3(3), key4(4);
607 Container
const& ccont = cont;
627 Container
const& ccont = cont;
636 Key key1(1), key2(2), key3(3), key4(4);
648 Container
const& ccont = cont;
656#if defined (STLPORT) && \
657 (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION))
658# if !defined (__DMC__)
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
CPPUNIT_TEST_SUITE(UnorderedTest)
CPPUNIT_TEST(equal_range)
CPPUNIT_TEST(template_methods)
CPPUNIT_EXPLICIT_TEST(benchmark2)
CPPUNIT_EXPLICIT_TEST(benchmark1)
CPPUNIT_TEST(hash_policy)
iterator insert(const value_type &__obj)
float max_load_factor() const
float max_load_factor() const
size_type bucket_count() const
size_type bucket_size(size_type __n) const
size_type max_bucket_count() const
float load_factor() const
pair< iterator, bool > insert(const value_type &__obj)
void rehash(size_type __hint)
hasher hash_function() const
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
#define CPPUNIT_ASSERT(X)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLsizei GLsizei GLfloat distance
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ int __cdecl rand(void)
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
bool operator()(Key const volatile *lhs, Key const volatile *rhs) const
bool operator()(Key lhs, Key rhs) const
size_t operator()(Key const volatile *key) const
size_t operator()(Key key) const
bool operator==(int d) const