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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <slist>
  6. #include <iterator>
  7.  
  8. #ifdef MAIN 
  9. #define slist1_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15.  
  16. int slist1_test(int, char**)
  17. {
  18.   cout<<"Results of slist1_test:"<<endl;
  19. char array [] = { 'x', 'l', 'x', 't', 's', 's' };
  20.   ostream_iterator<char> o(cout,"");
  21.   slist<char> str(array+0, array + 6);
  22.   std::slist<char>::iterator i;
  23.   cout << "original: ";
  24.   copy(str.begin(), str.end(),o);
  25.   cout << endl;
  26.   cout << "reversed: ";
  27.   str.reverse();
  28.   for(i = str.begin(); i != str.end(); i++)
  29.     cout << *i;
  30.   cout << endl;
  31.   cout << "removed: ";
  32.   str.remove('x');
  33.   for(i = str.begin(); i != str.end(); i++)
  34.     cout << *i;
  35.   cout << endl;
  36.   cout << "uniqued: ";
  37.   str.unique();
  38.   for(i = str.begin(); i != str.end(); i++)
  39.     cout << *i;
  40.   cout << endl;
  41.   cout << "sorted: ";
  42.   str.sort();
  43.   for(i = str.begin(); i != str.end(); i++)
  44.     cout << *i;
  45.   cout << endl;
  46.   return 0;
  47. }
  48.