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

Unified Diff: tests/lib/crypto/sha1_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « tests/lib/crypto/hmac_sha256_test.dart ('k') | tests/lib/crypto/sha256_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/crypto/sha1_test.dart
diff --git a/tests/lib/crypto/sha1_test.dart b/tests/lib/crypto/sha1_test.dart
index ba3ed4dd40a090e03a33ff8af2cd588c0f03afc4..b9e90697c15c2d01307038f07101bce316b0c529 100644
--- a/tests/lib/crypto/sha1_test.dart
+++ b/tests/lib/crypto/sha1_test.dart
@@ -11,7 +11,7 @@ part 'sha1_long_test_vectors.dart';
part 'sha1_short_test_vectors.dart';
List<int> createTestArr(int len) {
- var arr = new List<int>(len);
+ var arr = new List<int>.fixedLength(len);
for (var i = 0; i < len; i++) {
arr[i] = i;
}
@@ -534,26 +534,30 @@ void test() {
"11bca5b61fc1f6d59078ec5354bc6d9adecc0c5d",
];
for (var i = 0; i < expected_values.length; i++) {
- var digest = new SHA1().update(createTestArr(i)).digest();
+ var hash = new SHA1();
+ hash.add(createTestArr(i));
+ var digest = hash.close();
Expect.equals(expected_values[i], CryptoUtils.bytesToHex(digest));
}
}
void testInvalidUse() {
var sha = new SHA1();
- sha.digest();
- Expect.throws(() => sha.update([0]), (e) => e is HashException);
+ sha.close();
+ Expect.throws(() => sha.add([0]), (e) => e is HashException);
}
void testRepeatedDigest() {
var sha = new SHA1();
- var digest = sha.digest();
- Expect.listEquals(digest, sha.digest());
+ var digest = sha.close();
+ Expect.listEquals(digest, sha.close());
}
void testStandardVectors(inputs, mds) {
for (var i = 0; i < inputs.length; i++) {
- var d = new SHA1().update(inputs[i]).digest();
+ var hash = new SHA1();
+ hash.add(inputs[i]);
+ var d = hash.close();
Expect.equals(mds[i], CryptoUtils.bytesToHex(d), '$i');
}
}
« no previous file with comments | « tests/lib/crypto/hmac_sha256_test.dart ('k') | tests/lib/crypto/sha256_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698