Documentation for AbstractHash

Former-commit-id: 467b96c5d8b9ed9a3fddd7cf6f09803977b53caf
This commit is contained in:
Gawaboumga
2016-02-21 14:19:40 +01:00
parent 08caff5ea3
commit 0934c21967
2 changed files with 53 additions and 10 deletions

View File

@@ -0,0 +1,27 @@
#include <Nazara/Core/AbstractHash.hpp>
#include <Catch/catch.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <array>
SCENARIO("AbstractHash", "[CORE][ABSTRACTHASH]")
{
GIVEN("The hash SHA512")
{
std::unique_ptr<Nz::AbstractHash> SHA512 = Nz::AbstractHash::Get(Nz::HashType_SHA512);
SHA512->Begin();
WHEN("We introduce data")
{
std::array<Nz::UInt8, 4> array{ 0, 1, 2, 3 };
SHA512->Append(array.begin(), array.size());
THEN("We ask for the bytearray")
{
Nz::ByteArray byteArray = SHA512->End();
REQUIRE(byteArray.GetSize() == SHA512->GetDigestLength());
}
}
}
}