12 #include <tst/Verify.h>
14 #include <cppunit/extensions/HelperMacros.h>
27 class TestBit :
public CppUnit::TestFixture {
30 CPPUNIT_TEST(TestGet);
31 CPPUNIT_TEST(TestSet);
32 CPPUNIT_TEST(TestMask);
33 CPPUNIT_TEST_SUITE_END();
43 const int size =
sizeof(int)*8;
44 const int bc2 = 12345;
51 for (
int i = 0; i < size; ++i) {
52 out1 << (b1[i] ?
'^' :
'.');
57 CPPUNIT_ASSERT(Verify<Equal>(out1.str(), out2.str()));
58 CPPUNIT_ASSERT(Verify<Equal>(out1.str(), out3.str()));
64 const int size =
sizeof(int)*8;
65 const int number = 12345;
66 bitset<size> b1(number);
69 for (
int i = 0; i < size; ++i)
72 CPPUNIT_ASSERT(Verify<Equal>(b2, number));
78 const int n = (1 << 18) | (1 << 5);
83 CPPUNIT_ASSERT(Verify<Equal>(n, m));
85 for (
unsigned int i = 0; i < 8*
sizeof(int); ++i)
87 CPPUNIT_ASSERT(Verify<Equal>(m, 0));
91 CPPUNIT_ASSERT(Verify<Equal>(m, n+1));
94 CPPUNIT_ASSERT(Verify<Equal>(m, 1));
Bit::Array< T > AsBitArray(T &target)
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)