Index: tests/SHA1Test.cpp |
=================================================================== |
--- tests/SHA1Test.cpp (revision 8685) |
+++ tests/SHA1Test.cpp (working copy) |
@@ -7,19 +7,14 @@ |
#include "Test.h" |
#include "SkSHA1.h" |
-static bool digests_equal(const SkSHA1::Digest& expectedDigest, const SkSHA1::Digest& computedDigest) { |
- for (size_t i = 0; i < SK_ARRAY_COUNT(expectedDigest.data); ++i) { |
- if (expectedDigest.data[i] != computedDigest.data[i]) { |
- return false; |
- } |
- } |
- return true; |
-} |
+struct SHA1Digest { |
+ uint8_t data[20]; |
+}; |
static struct SHA1Test { |
const char* message; |
const unsigned long int repeatCount; |
- const SkSHA1::Digest digest; |
+ const SHA1Digest digestBytes; |
} sha1_tests[] = { |
// Reference tests from RFC3174 Section 7.3 ( http://www.ietf.org/rfc/rfc3174.txt ) |
{ "abc", 1, {{ 0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A, 0xBA, 0x3E, 0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C, 0x9C, 0xD0, 0xD8, 0x9D }} }, |
@@ -39,10 +34,11 @@ |
for (unsigned long int i = 0; i < test.repeatCount; ++i) { |
context.update(reinterpret_cast<const uint8_t*>(test.message), len); |
} |
- SkSHA1::Digest digest; |
- context.finish(digest); |
+ SkHashDigest actualDigest; |
+ context.finish(actualDigest); |
- REPORTER_ASSERT(reporter, digests_equal(test.digest, digest)); |
+ SkHashDigest expectedDigest(test.digestBytes.data, sizeof(test.digestBytes.data)); |
+ REPORTER_ASSERT(reporter, expectedDigest.equals(actualDigest)); |
} |
static void TestSHA1(skiatest::Reporter* reporter) { |