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 |
|
|
8 |
#ifdef MAIN
|
|
9 |
#define binsrch1_test main
|
|
10 |
#endif
|
|
11 |
|
|
12 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
13 |
using namespace std;
|
|
14 |
#endif
|
|
15 |
int binsrch1_test(int, char**)
|
|
16 |
{
|
|
17 |
cout<<"Results of binsrch1_test:"<<endl;
|
|
18 |
int vector[100];
|
|
19 |
for(int i = 0; i < 100; i++)
|
|
20 |
vector[i] = i;
|
|
21 |
|
|
22 |
if(binary_search(vector, vector + 100, 42))
|
|
23 |
{
|
|
24 |
cout << "found 42" << endl;
|
|
25 |
return 0;
|
|
26 |
}
|
|
27 |
else
|
|
28 |
{
|
|
29 |
cout << "did not find 42" << endl;
|
|
30 |
return 1;
|
|
31 |
}
|
|
32 |
}
|