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 modulus_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
int modulus_test(int, char**)
|
|
17 |
{
|
|
18 |
cout<<"Results of modulus_test:"<<endl;
|
|
19 |
int input1 [4] = { 6, 8, 10, 2 };
|
|
20 |
int input2 [4] = { 4, 2, 11, 3 };
|
|
21 |
int failures = 0;
|
|
22 |
int output [4];
|
|
23 |
transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, modulus<int>());
|
|
24 |
for(int i = 0; i < 4; i++)
|
|
25 |
cout << output[i] << endl;
|
|
26 |
|
|
27 |
if (output[0] != 2)
|
|
28 |
failures++;
|
|
29 |
if (output[1] != 0)
|
|
30 |
failures++;
|
|
31 |
if (output[2] != 10)
|
|
32 |
failures++;
|
|
33 |
if (output[3] != 2)
|
|
34 |
failures++;
|
|
35 |
return failures;
|
|
36 |
}
|