home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl2vac.zip / STLport-4_5_3.zip / STLport-4.5.3 / test / regression / equal2.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  730b  |  36 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <vector>
  5. #include <algorithm>
  6. #include <iostream>
  7.  
  8. #ifdef MAIN 
  9. #define equal2_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15. bool values_squared(int a_, int b_)
  16. {
  17.   return(a_ * a_ == b_);
  18. }
  19. int equal2_test(int, char**)
  20. {
  21.   cout<<"Results of equal2_test:"<<endl;
  22.  
  23.   vector <int> v1(10);
  24.   vector <int> v2(10);
  25.   for(int i = 0; i < v1.size(); i++)
  26.   {
  27.     v1[i] = i;
  28.     v2[i] = i * i;
  29.   }
  30.   if(equal(v1.begin(), v1.end(), v2.begin(), values_squared))
  31.     cout << "v2[i] == v1[i] * v1[i]" << endl;
  32.   else
  33.     cout << "v2[i] != v1[i] * v1[i]" << endl;
  34.   return 0;
  35. }
  36.