Skip to content

Commit

Permalink
Implemented GetLength method
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Kornyakov committed Sep 3, 2015
1 parent 5bd69e6 commit c7aaef1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tbitfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TELEM TBitField::GetMemMask(const int n) const // битовая маска дл

int TBitField::GetLength(void) const // получить длину (к-во битов)
{

return BitLen;
}

void TBitField::SetBit(const int n) // установить бит
Expand Down
5 changes: 4 additions & 1 deletion test/test_tbitfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ TEST(TBitField, new_bitfield_is_set_to_zero)
{
TBitField bf(100);

int sum = 0;
for (int i = 0; i < bf.GetLength(); i++)
{
EXPECT_EQ(0, bf.GetBit(i));
sum += bf.GetBit(i);
}

EXPECT_EQ(0, sum);
}

TEST(TBitField, can_set_bit)
Expand Down

0 comments on commit c7aaef1

Please sign in to comment.