From c7aaef11c7860333558e1f6b4e628e73b1fb9f36 Mon Sep 17 00:00:00 2001 From: Kirill Kornyakov Date: Thu, 3 Sep 2015 09:48:51 +0300 Subject: [PATCH] Implemented GetLength method --- src/tbitfield.cpp | 2 +- test/test_tbitfield.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tbitfield.cpp b/src/tbitfield.cpp index 8445135da..b7952b131 100644 --- a/src/tbitfield.cpp +++ b/src/tbitfield.cpp @@ -46,7 +46,7 @@ TELEM TBitField::GetMemMask(const int n) const // битовая маска дл int TBitField::GetLength(void) const // получить длину (к-во битов) { - + return BitLen; } void TBitField::SetBit(const int n) // установить бит diff --git a/test/test_tbitfield.cpp b/test/test_tbitfield.cpp index 53d6dc29e..580e3e16c 100644 --- a/test/test_tbitfield.cpp +++ b/test/test_tbitfield.cpp @@ -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)