Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: tests/lib/src/crypto/sha1Test.dart

Issue 10174041: Increase test coverage for sha1 and sha256 by using standard test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/src/crypto/sha1_short_test_vectors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/src/crypto/sha1Test.dart
diff --git a/tests/lib/src/crypto/sha1Test.dart b/tests/lib/src/crypto/sha1Test.dart
index 5d1fae4b66a0e04cc9bbdc8a51d217be53f08122..88334eb10b54b3ba331874ff7b7151159cf1f42d 100644
--- a/tests/lib/src/crypto/sha1Test.dart
+++ b/tests/lib/src/crypto/sha1Test.dart
@@ -5,6 +5,9 @@
// TODO(ager): Replace with "dart:crypto" when ready.
#import("../../../../lib/crypto/crypto.dart");
+#source('sha1_long_test_vectors.dart');
+#source('sha1_short_test_vectors.dart');
+
List<int> createTestArr(int len) {
var arr = new List<int>(len);
for (var i = 0; i < len; i++) {
@@ -551,7 +554,16 @@ void testInvalidUse() {
(e) => e is CryptoHashException);
}
+void testStandardVectors(inputs, mds) {
+ for (var i = 0; i < inputs.length; i++) {
+ var d = new SHA1().update(inputs[i]).digest();
+ Expect.equals(mds[i], digestToString(d), '$i');
+ }
+}
+
void main() {
test();
testInvalidUse();
+ testStandardVectors(sha1_long_inputs, sha1_long_mds);
+ testStandardVectors(sha1_short_inputs, sha1_short_mds);
}
« no previous file with comments | « no previous file | tests/lib/src/crypto/sha1_short_test_vectors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698