Fix another lot of warnings from Clang

Closes #90
Closes #91
Closes #92
Closes #93
This commit is contained in:
Lynix
2016-10-17 16:01:05 +02:00
parent 7e594a861f
commit 4c6f049e0d
26 changed files with 87 additions and 71 deletions

View File

@@ -14,13 +14,13 @@ SCENARIO("AbstractHash", "[CORE][ABSTRACTHASH]")
WHEN("We introduce data")
{
std::array<Nz::UInt8, 4> array{ 0, 1, 2, 3 };
std::array<Nz::UInt8, 4> array{ { 0, 1, 2, 3 } };
SHA512->Append(array.data(), array.size());
THEN("We ask for the bytearray")
{
Nz::ByteArray byteArray = SHA512->End();
REQUIRE(byteArray.GetSize() == SHA512->GetDigestLength());
CHECK(byteArray.GetSize() == SHA512->GetDigestLength());
}
}
}

View File

@@ -11,8 +11,8 @@ SCENARIO("Bitset", "[CORE][BITSET]")
THEN("Capacity is 3 and size is 3")
{
REQUIRE(bitset.GetSize() == 3);
REQUIRE(bitset.GetCapacity() >= 3);
CHECK(bitset.GetSize() == 3);
CHECK(bitset.GetCapacity() >= 3);
}
}
@@ -25,11 +25,11 @@ SCENARIO("Bitset", "[CORE][BITSET]")
WHEN("We assign 'anotherData'")
{
defaultByte = anotherDataString;
REQUIRE(anotherData == defaultByte);
REQUIRE(defaultByte.GetSize() == 4);
REQUIRE(defaultByte.GetCapacity() >= 4);
REQUIRE(anotherData.GetSize() == 4);
REQUIRE(anotherData.GetCapacity() >= 4);
CHECK(anotherData == defaultByte);
CHECK(defaultByte.GetSize() == 4);
CHECK(defaultByte.GetCapacity() >= 4);
CHECK(anotherData.GetSize() == 4);
CHECK(anotherData.GetCapacity() >= 4);
}
}
@@ -43,17 +43,17 @@ SCENARIO("Bitset", "[CORE][BITSET]")
THEN("We get a copy")
{
REQUIRE(copyBitset == originalArray);
CHECK(copyBitset == originalArray);
AND_WHEN("We modify one")
{
for (auto i = 0; i < copyBitset.GetSize(); ++i)
for (std::size_t i = 0; i < copyBitset.GetSize(); ++i)
copyBitset[i] = false;
THEN("They are no more equal")
{
REQUIRE(copyBitset != originalArray);
REQUIRE(copyBitset == Nz::Bitset<>(3, false));
CHECK(copyBitset != originalArray);
CHECK(copyBitset == Nz::Bitset<>(3, false));
}
}
}

View File

@@ -7,40 +7,40 @@ SCENARIO("SparsePtr", "[CORE][SPARSEPTR]")
{
GIVEN("A sparse pointer pointing to an array with a stride of 2")
{
std::array<int, 5> arrays{0, 1, 2, 3, 4};
std::array<int, 5> arrays = { {0, 1, 2, 3, 4} };
Nz::SparsePtr<int> sparsePtr(arrays.data(), 2 * sizeof(int));
WHEN("We use operators")
{
THEN("Operator[] with 2 should be 4")
{
REQUIRE(4 == sparsePtr[2]);
CHECK(4 == sparsePtr[2]);
}
THEN("Operator++ and Operator-- should be opposite")
{
++sparsePtr;
REQUIRE(2 == *sparsePtr);
CHECK(2 == *sparsePtr);
auto old = sparsePtr++;
REQUIRE(2 == *old);
REQUIRE(4 == *sparsePtr);
CHECK(2 == *old);
CHECK(4 == *sparsePtr);
--sparsePtr;
REQUIRE(2 == *sparsePtr);
CHECK(2 == *sparsePtr);
auto oldMinus = sparsePtr--;
REQUIRE(2 == *oldMinus);
REQUIRE(0 == *sparsePtr);
CHECK(2 == *oldMinus);
CHECK(0 == *sparsePtr);
}
THEN("Operator+ and operator-")
{
auto offsetTwo = sparsePtr + 2;
REQUIRE(4 == *offsetTwo);
CHECK(4 == *offsetTwo);
auto offsetZero = offsetTwo - 2;
REQUIRE(0 == *offsetZero);
CHECK(0 == *offsetZero);
REQUIRE((offsetTwo - offsetZero) == 2);
CHECK((offsetTwo - offsetZero) == 2);
}
}
}