31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <algorithm>
|
|
6 |
#include <iostream>
|
|
7 |
|
|
8 |
#ifdef MAIN
|
|
9 |
#define rotcopy0_test main
|
|
10 |
#endif
|
|
11 |
|
|
12 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
13 |
using namespace std;
|
|
14 |
#endif
|
|
15 |
int rotcopy0_test(int, char**)
|
|
16 |
{
|
|
17 |
int failures=0;
|
|
18 |
cout<<"Results of rotcopy0_test:"<<endl;
|
|
19 |
int numbers[6] = { 0, 1, 2, 3, 4, 5 };
|
|
20 |
|
|
21 |
int result[6];
|
|
22 |
rotate_copy((int*)numbers, (int*)numbers + 3, (int*)numbers + 6, (int*)result);
|
|
23 |
for(int i = 0; i < 6; i++)
|
|
24 |
cout << result[i] << ' ';
|
|
25 |
cout << endl;
|
|
26 |
|
|
27 |
if(3!=result[0])
|
|
28 |
failures++;
|
|
29 |
else if(4!=result[1])
|
|
30 |
failures++;
|
|
31 |
else if(5!=result[2])
|
|
32 |
failures++;
|
|
33 |
else if(0!=result[3])
|
|
34 |
failures++;
|
|
35 |
else if(1!=result[4])
|
|
36 |
failures++;
|
|
37 |
else if(2!=result[5])
|
|
38 |
failures++;
|
|
39 |
|
|
40 |
|
|
41 |
if(failures)
|
|
42 |
return 1;
|
|
43 |
else
|
|
44 |
return 0;
|
|
45 |
}
|
|
46 |
|