ReactOS  0.4.15-dev-2993-g14fbe80
BitsetTest Class Reference
Inheritance diagram for BitsetTest:
Collaboration diagram for BitsetTest:

Protected Member Functions

void bitset1 ()
 
void iostream ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (BitsetTest)
 
 CPPUNIT_TEST (bitset1)
 
 CPPUNIT_TEST (iostream)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 16 of file bitset_test.cpp.

Member Function Documentation

◆ bitset1()

void BitsetTest::bitset1 ( )
protected

Definition at line 36 of file bitset_test.cpp.

37 {
38  bitset<13U> b1(0xFFFF);
39  bitset<13U> b2(0x1111);
40  CPPUNIT_ASSERT(b1.size() == 13);
41  CPPUNIT_ASSERT(b1 == 0x1FFF);
42  CPPUNIT_ASSERT(b2.size() == 13);
43  CPPUNIT_ASSERT(b2 == 0x1111);
44 
45 #if !defined (STLPORT) || !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
46  b1 = b1 ^ (b2 << 2);
47  CPPUNIT_ASSERT(b1 == 0x1BBB);
48 
49  CPPUNIT_ASSERT(b1.count() == 10);
50  CPPUNIT_ASSERT(b2.count() == 4);
51 
52 # if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
53  size_t __pos = b2._Find_first();
54  CPPUNIT_ASSERT( __pos == 0 );
55  __pos = b2._Find_next(__pos);
56  CPPUNIT_ASSERT( __pos == 4 );
57  __pos = b2._Find_next(__pos);
58  CPPUNIT_ASSERT( __pos == 8 );
59  __pos = b2._Find_next(__pos);
60  CPPUNIT_ASSERT( __pos == 12 );
61  __pos = b2._Find_next(__pos);
62  CPPUNIT_ASSERT( __pos == 13 );
63 # endif
64 #endif
65 
66 #if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
67  string representation = b2.to_string<char, char_traits<char>, allocator<char> >();
68  CPPUNIT_ASSERT( representation == "1000100010001" );
69 # if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
70  wstring wrepresentation = b2.to_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >();
71  CPPUNIT_ASSERT( wrepresentation == L"1000100010001" );
72 # endif
73 #else
74  CPPUNIT_ASSERT( b2.to_string() == "1000100010001" );
75 #endif
76 }
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
unsigned char
Definition: typeof.h:29
static const WCHAR L[]
Definition: oid.c:1250
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
#define wchar_t
Definition: wchar.h:102
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582

◆ CPPUNIT_TEST() [1/2]

BitsetTest::CPPUNIT_TEST ( bitset1  )
private

◆ CPPUNIT_TEST() [2/2]

BitsetTest::CPPUNIT_TEST ( iostream  )
private

◆ CPPUNIT_TEST_SUITE()

BitsetTest::CPPUNIT_TEST_SUITE ( BitsetTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

BitsetTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ iostream()

void BitsetTest::iostream ( )
protected

Definition at line 78 of file bitset_test.cpp.

79 {
80 #if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
81  {
82  stringstream sstr;
83  bitset<13U> b(0x1111);
84  sstr << b;
85  CPPUNIT_ASSERT( sstr.str() == "1000100010001" );
86 
88  sstr >> b1;
89  CPPUNIT_ASSERT( b1.test(0) );
90  CPPUNIT_ASSERT( b1.test(4) );
91  CPPUNIT_ASSERT( b1.test(8) );
92  CPPUNIT_ASSERT( b1.test(12) );
93  }
94 # if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
95  {
96  wstringstream sstr;
97  bitset<13U> b(0x1111);
98  sstr << b;
99  CPPUNIT_ASSERT( sstr.str() == L"1000100010001" );
100 
101  bitset<13U> b1;
102  sstr >> b1;
103  CPPUNIT_ASSERT( b1.test(0) );
104  CPPUNIT_ASSERT( b1.test(4) );
105  CPPUNIT_ASSERT( b1.test(8) );
106  CPPUNIT_ASSERT( b1.test(12) );
107  }
108 # endif
109 #endif
110 }
_String str() const
Definition: _sstream.h:230
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
#define b
Definition: ke_i.h:79
static const WCHAR L[]
Definition: oid.c:1250
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

The documentation for this class was generated from the following file: