mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
[510] move declaration into fixture
This commit is contained in:
@@ -31,13 +31,13 @@ using namespace isc::statistics;
|
|||||||
// This fixture is for testing Counter.
|
// This fixture is for testing Counter.
|
||||||
class CounterTest : public ::testing::Test {
|
class CounterTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
CounterTest() {}
|
CounterTest() : counter(NUMBER_OF_ITEMS) {}
|
||||||
~CounterTest() {}
|
~CounterTest() {}
|
||||||
|
|
||||||
|
Counter counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(CounterTest, createCounter) {
|
TEST_F(CounterTest, createCounter) {
|
||||||
// Create counter
|
|
||||||
Counter counter(NUMBER_OF_ITEMS);
|
|
||||||
// Check if the all counters are initialized with 0
|
// Check if the all counters are initialized with 0
|
||||||
EXPECT_EQ(counter.get(ITEM1), 0);
|
EXPECT_EQ(counter.get(ITEM1), 0);
|
||||||
EXPECT_EQ(counter.get(ITEM2), 0);
|
EXPECT_EQ(counter.get(ITEM2), 0);
|
||||||
@@ -45,8 +45,6 @@ TEST_F(CounterTest, createCounter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CounterTest, incrementCounterItem) {
|
TEST_F(CounterTest, incrementCounterItem) {
|
||||||
// Create counter
|
|
||||||
Counter counter(NUMBER_OF_ITEMS);
|
|
||||||
// Increment counters
|
// Increment counters
|
||||||
counter.inc(ITEM1);
|
counter.inc(ITEM1);
|
||||||
counter.inc(ITEM2);
|
counter.inc(ITEM2);
|
||||||
@@ -78,8 +76,6 @@ TEST_F(CounterTest, invalidCounterSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CounterTest, invalidCounterItem) {
|
TEST_F(CounterTest, invalidCounterItem) {
|
||||||
// Create counter
|
|
||||||
Counter counter(NUMBER_OF_ITEMS);
|
|
||||||
// Incrementing out-of-bound counter will cause an isc::OutOfRange
|
// Incrementing out-of-bound counter will cause an isc::OutOfRange
|
||||||
// exception
|
// exception
|
||||||
EXPECT_THROW(counter.inc(NUMBER_OF_ITEMS), isc::OutOfRange);
|
EXPECT_THROW(counter.inc(NUMBER_OF_ITEMS), isc::OutOfRange);
|
||||||
|
Reference in New Issue
Block a user