OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
| 8 #include "SkSHA1.h" |
8 #include "Test.h" | 9 #include "Test.h" |
9 #include "SkSHA1.h" | |
10 | 10 |
11 static bool digests_equal(const SkSHA1::Digest& expectedDigest, const SkSHA1::Di
gest& computedDigest) { | 11 static bool digests_equal(const SkSHA1::Digest& expectedDigest, const SkSHA1::Di
gest& computedDigest) { |
12 for (size_t i = 0; i < SK_ARRAY_COUNT(expectedDigest.data); ++i) { | 12 for (size_t i = 0; i < SK_ARRAY_COUNT(expectedDigest.data); ++i) { |
13 if (expectedDigest.data[i] != computedDigest.data[i]) { | 13 if (expectedDigest.data[i] != computedDigest.data[i]) { |
14 return false; | 14 return false; |
15 } | 15 } |
16 } | 16 } |
17 return true; | 17 return true; |
18 } | 18 } |
19 | 19 |
(...skipping 24 matching lines...) Expand all Loading... |
44 context.finish(digest); | 44 context.finish(digest); |
45 | 45 |
46 REPORTER_ASSERT(reporter, digests_equal(test.digest, digest)); | 46 REPORTER_ASSERT(reporter, digests_equal(test.digest, digest)); |
47 } | 47 } |
48 | 48 |
49 DEF_TEST(SHA1, reporter) { | 49 DEF_TEST(SHA1, reporter) { |
50 for (size_t i = 0; i < SK_ARRAY_COUNT(sha1_tests); ++i) { | 50 for (size_t i = 0; i < SK_ARRAY_COUNT(sha1_tests); ++i) { |
51 sha1_test(sha1_tests[i], reporter); | 51 sha1_test(sha1_tests[i], reporter); |
52 } | 52 } |
53 } | 53 } |
OLD | NEW |