Skip to content

Commit

Permalink
New TBitFiels test for invert and operator&
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-sidnev committed Oct 16, 2015
1 parent f8d2763 commit ab7d7d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/test_tbitfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,25 @@ TEST(TBitField, can_invert_large_bitfield)
EXPECT_EQ(expNegBf, negBf);
}

TEST(TBitField, invert_plus_and_operator_on_different_size_bitfield)
{
const int firstSze = 4, secondSize = 8;
TBitField firstBf(firstSze), negFirstBf(firstSze), secondBf(secondSize), testBf(secondSize);
// firstBf = 0001
firstBf.SetBit(0);
negFirstBf = ~firstBf;
// negFirstBf = 1110

// secondBf = 00011000
secondBf.SetBit(3);
secondBf.SetBit(4);

// testBf = 00001000
testBf.SetBit(3);

EXPECT_EQ(secondBf & negFirstBf, testBf);
}

TEST(TBitField, can_invert_many_random_bits_bitfield)
{
const int size = 38;
Expand Down

0 comments on commit ab7d7d1

Please sign in to comment.