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