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