mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
Added test documentation & Keccak unit test
This commit is contained in:
parent
1a73843cec
commit
f6119a8eaa
1 changed files with 28 additions and 0 deletions
|
@ -47,6 +47,14 @@ namespace
|
||||||
"8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94"
|
"8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94"
|
||||||
"6c7251d54154cfa92c173a0dd39c1f948b655970153799af2aeadc9ff1add0ea";
|
"6c7251d54154cfa92c173a0dd39c1f948b655970153799af2aeadc9ff1add0ea";
|
||||||
|
|
||||||
|
static std::uint8_t md[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool is_formatted()
|
bool is_formatted()
|
||||||
{
|
{
|
||||||
|
@ -61,6 +69,26 @@ namespace
|
||||||
out << "BEGIN" << value << "END";
|
out << "BEGIN" << value << "END";
|
||||||
return out.str() == "BEGIN<" + std::string{expected, sizeof(T) * 2} + ">END";
|
return out.str() == "BEGIN<" + std::string{expected, sizeof(T) * 2} + ">END";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool keccak_harness()
|
||||||
|
{
|
||||||
|
size_t inlen = sizeof(source);
|
||||||
|
int mdlen = (int)sizeof(md);
|
||||||
|
int ret = keccak(source, inlen, md, mdlen);
|
||||||
|
|
||||||
|
if (md[0] != 0x00)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (!ret)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Crypto, Ostream)
|
TEST(Crypto, Ostream)
|
||||||
|
|
Loading…
Reference in a new issue