31
|
1 |
|
|
2 |
|
|
3 |
// STLport regression testsuite component.
|
|
4 |
// To compile as a separate example, please #define MAIN.
|
|
5 |
|
|
6 |
#include <algorithm>
|
|
7 |
#include <iostream>
|
|
8 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define uprbnd1_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
int uprbnd1_test(int, char**)
|
|
17 |
{
|
|
18 |
int x=0;
|
|
19 |
|
|
20 |
cout<<"Results of uprbnd1_test:"<<endl;
|
|
21 |
int array[20];
|
|
22 |
for(int i = 0; i < 20; i++)
|
|
23 |
{
|
|
24 |
array[i] = i/4;
|
|
25 |
cout << array[i] << ' ';
|
|
26 |
}
|
|
27 |
|
|
28 |
x=(upper_bound((int*)array, (int*)array + 20, 3) - array);
|
|
29 |
|
|
30 |
cout<< "\n3 can be inserted at index: "<<x << endl;
|
|
31 |
|
|
32 |
if(16!=x)
|
|
33 |
return 1;
|
|
34 |
else
|
|
35 |
return 0;
|
|
36 |
}
|
|
37 |
|
|
38 |
/*sults of uprbnd1_test:
|
|
39 |
0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
|
|
40 |
3 can be inserted at index: 16*/
|