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