home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / bitset1.cpp < prev    next >
C/C++ Source or Header  |  2001-08-01  |  1KB  |  59 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4.  
  5. #include <stdexcept>
  6. #include <iostream>
  7. #include <bitset>
  8. #include <algorithm>
  9.  
  10. #if defined (_STLP_MSVC) && (_MSC_VER < 1300)
  11. # define _STLP_NON_TYPE_TMPL_PARAM_BUG
  12. # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
  13. #endif
  14.  
  15. # ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
  16. # define CHART
  17. # else
  18. # define CHART <char, char_traits<char>, allocator<char> >
  19. # endif
  20.  
  21. #ifdef MAIN 
  22. #define bitset1_test main
  23. #endif
  24.  
  25. #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
  26. using namespace std;
  27. #endif
  28.  
  29. int bitset1_test(int, char**)
  30. {
  31.   cout<<"Results of bitset1_test:"<<endl;
  32.  
  33. # if ! (defined (_STLP_MSVC) && (_MSC_VER < 1300)) && ! (defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500))
  34.   bitset<13U> b1(0xFFFF);
  35.   bitset<13U> b2(0x1111);
  36.   // Boris : MSVC just cannot take it right
  37.   cout << "b1 size = " << b1.size() << endl;
  38. # if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
  39.   cout << "b1 = "<<b1<<endl;
  40. # else
  41.   cout << "b1 = "<<b1.to_string CHART ()<<endl;
  42. # endif
  43.   cout << "b2 size = " << b2.size() << endl;
  44. # if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
  45.   cout << "b2 = "<<b2.to_string CHART ()<<endl;
  46. # else
  47.   cout << "b2 = "<<b2<<endl;
  48. # endif
  49.   b1 = b1^(b2<<2);
  50. # ifdef _STLP_NON_TYPE_TMPL_PARAM_BUG
  51.   cout << "b1 = "<<b1.to_string CHART ()<<endl;
  52. # else
  53.   cout << "b1 = "<<b1<<endl;
  54. # endif
  55. # endif /* MSVC */
  56.   return 0;
  57. }
  58.  
  59.