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