home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / search0.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  899b  |  34 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 search0_test main
  9. #endif
  10.  
  11. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  12. using namespace std;
  13. #endif
  14. int search0_test(int, char**)
  15. {
  16.   cout<<"Results of search0_test:"<<endl;
  17. int v1[6] = { 1, 1, 2, 3, 5, 8 };
  18. int v2[6] = { 0, 1, 2, 3, 4, 5 };
  19. int v3[2] = { 3, 4 };
  20.  
  21.   int* location;
  22.   location = search((int*)v1, (int*)v1 + 6, (int*)v3, (int*)v3 + 2);
  23.   if(location == v1 + 6)
  24.     cout << "v3 not contained in v1" << endl;
  25.   else
  26.     cout << "Found v3 in v1 at offset: " << location - v1 << endl;
  27.   location = search((int*)v2, (int*)v2 + 6, (int*)v3, (int*)v3 + 2);
  28.   if(location == v2 + 6)
  29.     cout << "v3 not contained in v2" << endl;
  30.   else
  31.     cout << "Found v3 in v2 at offset: " << location - v2 << endl;
  32.   return 0;
  33. }
  34.