home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / mismtch0.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  942b  |  33 lines

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