31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <vector>
|
|
6 |
#include <numeric>
|
|
7 |
#include <iostream>
|
|
8 |
|
|
9 |
|
|
10 |
#ifdef MAIN
|
|
11 |
#define accum1_test main
|
|
12 |
#endif
|
|
13 |
|
|
14 |
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
|
|
15 |
using namespace std;
|
|
16 |
#endif
|
|
17 |
|
|
18 |
|
|
19 |
int accum1_test(int, char**)
|
|
20 |
{
|
|
21 |
cout<<"Results of accum1_test:"<<endl;
|
|
22 |
vector <int> v(5);
|
|
23 |
for(int i = 0; i < v.size(); i++)
|
|
24 |
v[i] = i + 1;
|
|
25 |
int sum = accumulate(v.begin(), v.end(), 0);
|
|
26 |
cout << "sum = " << sum << endl;
|
|
27 |
|
|
28 |
if (sum == 15)
|
|
29 |
return 0;
|
|
30 |
else
|
|
31 |
return 1;
|
|
32 |
}
|