aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-06 01:52:08 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-06 01:52:08 +0200
commit9d65a9cc98ae5f72a0ed3d4cb839cdab36fb48e7 (patch)
tree9075895aa65203b5b9ebcd7c7c4815edbe9ddca8 /tests/unit_tests
parentMerge pull request #2729 (diff)
parentEdited test readme for accuracy and depth (diff)
downloadmonero-9d65a9cc98ae5f72a0ed3d4cb839cdab36fb48e7.tar.xz
Merge pull request #2483
ff7745bb Edited test readme for accuracy and depth (Cole Lightfighter) c300ae56 Added test documentation & Keccak unit test (Cole Lightfighter) f6119a8e Added test documentation & Keccak unit test (Cole Lightfighter)
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/crypto.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit_tests/crypto.cpp b/tests/unit_tests/crypto.cpp
index 3a8e787ec..51e26c2bb 100644
--- a/tests/unit_tests/crypto.cpp
+++ b/tests/unit_tests/crypto.cpp
@@ -47,6 +47,14 @@ namespace
"8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94"
"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>
bool is_formatted()
{
@@ -61,6 +69,26 @@ namespace
out << "BEGIN" << value << "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)