home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / trnsfrm2.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  826b  |  37 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <algorithm>
  5. #include <iostream>
  6. #include <cstring>
  7. #include <iterator>
  8. #include <functional>
  9.  
  10. #ifdef MAIN 
  11. #define trnsfrm2_test main
  12. #endif
  13. static char map_char(char a_, int b_)
  14. {
  15.   return char(a_ + b_);
  16. }
  17.  
  18. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  19. using namespace std;
  20. #endif
  21. int trnsfrm2_test(int, char**)
  22. {
  23.   cout<<"Results of trnsfrm2_test:"<<endl;
  24.  
  25. #if defined (__MVS__)
  26. int trans[] = {-11, 4, -6, -6, -18, 0, 18, -14, 6, 0, -1, -59};
  27. #else
  28. int trans[] = {-4, 4, -6, -6, -10, 0, 10, -6, 6, 0, -1, -77};
  29. #endif
  30.   char n[] = "Larry Mullen";
  31.   const unsigned count = ::strlen(n);
  32.   ostream_iterator <char> iter(cout);
  33.   transform(n, n + count, trans, iter, map_char);
  34.   cout << endl;
  35.   return 0;
  36. }
  37.