StackVector: Test destruction

Before this commit, only clear() was checked, destructor was not
This commit is contained in:
Lynix 2019-09-25 16:29:48 +02:00
parent 76812510a1
commit 489e3e0b5e
1 changed files with 171 additions and 169 deletions

View File

@ -99,6 +99,8 @@ class DestructionCounter
SCENARIO("StackVector", "[CORE][STACKVECTOR]")
{
GIVEN("A StackVector to contain multiple int")
{
std::size_t counter = 0;
{
volatile std::size_t capacity = 50;
#if USE_STD_VECTOR
@ -107,7 +109,6 @@ SCENARIO("StackVector", "[CORE][STACKVECTOR]")
#else
Nz::StackVector<DestructionCounter> vector = NazaraStackVector(DestructionCounter, capacity);
#endif
std::size_t counter = 0;
WHEN("At construction, the vector is empty but has capacity")
{
@ -175,6 +176,7 @@ SCENARIO("StackVector", "[CORE][STACKVECTOR]")
CHECK(vector.empty());
CHECK(vector.size() == 0);
CHECK(counter == 0);
}
}
}
@ -313,8 +315,8 @@ SCENARIO("StackVector", "[CORE][STACKVECTOR]")
std::array<int, 10> expectedValues = { 1, 3, 5, 7, 9, 8, 6, 4, 2, 0 };
CHECK(std::equal(vector.begin(), vector.end(), expectedValues.begin(), expectedValues.end()));
}
}
vector.clear();
CHECK(counter == 0);
}
}