| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include <testsuite_hooks.h> |
| 21 |
|
| 22 |
|
| 23 |
template<typename _Tp> |
| 24 |
void |
| 25 |
operations03() |
| 26 |
{ |
| 27 |
typedef _Tp list_type; |
| 28 |
typedef typename list_type::iterator iterator; |
| 29 |
|
| 30 |
const int A[] = {103, 203, 603, 303, 403, 503}; |
| 31 |
const int B[] = {417, 417, 417, 417, 417}; |
| 32 |
const int E[] = {103, 417, 417, 203, 603, 303, 403, 503}; |
| 33 |
const int F[] = {103, 203, 303, 403, 417, 417, 503, 603}; |
| 34 |
const int C[] = {103, 203, 303, 403, 417, 417, 417, 417, 417, 503, 603}; |
| 35 |
const int D[] = {103, 203, 303, 403, 417, 503, 603}; |
| 36 |
const int N = sizeof(A) / sizeof(int); |
| 37 |
const int M = sizeof(B) / sizeof(int); |
| 38 |
const int P = sizeof(C) / sizeof(int); |
| 39 |
const int Q = sizeof(D) / sizeof(int); |
| 40 |
const int R = sizeof(E) / sizeof(int); |
| 41 |
|
| 42 |
list_type list0301(A, A + N); |
| 43 |
list_type list0302(B, B + M); |
| 44 |
list_type list0303(C, C + P); |
| 45 |
list_type list0304(D, D + Q); |
| 46 |
list_type list0305(E, E + R); |
| 47 |
list_type list0306(F, F + R); |
| 48 |
iterator p = list0301.begin(); |
| 49 |
iterator q = list0302.begin(); |
| 50 |
|
| 51 |
++p; ++q; ++q; |
| 52 |
list0301.splice(p, list0302, list0302.begin(), q); |
| 53 |
VERIFY(list0301 == list0305); |
| 54 |
VERIFY(list0301.size() == N + 2); |
| 55 |
VERIFY(list0302.size() == M - 2); |
| 56 |
|
| 57 |
list0301.sort(); |
| 58 |
VERIFY(list0301 == list0306); |
| 59 |
|
| 60 |
list0301.merge(list0302); |
| 61 |
VERIFY(list0301.size() == N + M); |
| 62 |
VERIFY(list0302.size() == 0); |
| 63 |
VERIFY(list0301 == list0303); |
| 64 |
|
| 65 |
list0301.unique(); |
| 66 |
VERIFY(list0301 == list0304); |
| 67 |
} |