31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <algorithm>
|
|
6 |
#include <iostream>
|
|
7 |
|
|
8 |
#ifdef MAIN
|
|
9 |
#define mismtch0_test main
|
|
10 |
#endif
|
|
11 |
|
|
12 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
13 |
using namespace std;
|
|
14 |
#endif
|
|
15 |
int mismtch0_test(int, char**)
|
|
16 |
{
|
|
17 |
cout<<"Results of mismtch0_test:"<<endl;
|
|
18 |
int n1[5] = { 1, 2, 3, 4, 5 };
|
|
19 |
int n2[5] = { 1, 2, 3, 4, 5 };
|
|
20 |
int n3[5] = { 1, 2, 3, 2, 1 };
|
|
21 |
int failures = 0;
|
|
22 |
pair <int*, int*> result = mismatch((int*)n1, (int*)n1 + 5, (int*)n2);
|
|
23 |
if(result.first ==(n1 + 5) && result.second ==(n2 + 5))
|
|
24 |
cout << "n1 and n2 are the same" << endl;
|
|
25 |
else
|
|
26 |
{
|
|
27 |
cout << "Mismatch at offset: " <<(result.first - n1) << endl;
|
|
28 |
failures++;
|
|
29 |
}
|
|
30 |
result = mismatch((int*)n1, (int*)n1 + 5, (int*)n3);
|
|
31 |
if(result.first ==(n1 + 5) && result.second ==(n3 + 5))
|
|
32 |
{
|
|
33 |
failures++;
|
|
34 |
cout << "n1 and n3 are the same" << endl;
|
|
35 |
}
|
|
36 |
else
|
|
37 |
cout << "Mismatch at offset: " <<(result.first - n1) << endl;
|
|
38 |
return failures;
|
|
39 |
}
|