Core/ByteArray: Make constructor taking a size set the size instead of capacity

This commit is contained in:
SirLynix 2024-02-24 20:38:34 +01:00
parent edac2e4af5
commit 7b0165a7df
2 changed files with 6 additions and 4 deletions

View File

@ -15,7 +15,7 @@ namespace Nz
inline ByteArray::ByteArray(size_type n) :
m_array()
{
m_array.reserve(n);
m_array.resize(n);
}
/*!

View File

@ -6,9 +6,10 @@
SCENARIO("ByteArray", "[CORE][BYTEARRAY]")
{
GIVEN("Allocate and raw constructor")
GIVEN("Reserve memory")
{
Nz::ByteArray byteArray(3);
Nz::ByteArray byteArray;
byteArray.Reserve(3);
THEN("Capacity is 3 and size is 0")
{
@ -144,7 +145,8 @@ SCENARIO("ByteArray", "[CORE][BYTEARRAY]")
GIVEN("One byte array of capacity 10")
{
Nz::ByteArray capacityArray(10);
Nz::ByteArray capacityArray;
capacityArray.Reserve(10);
WHEN("We reserve for 100")
{