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

Unified Diff: tests/lib/crypto/sha256_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/sha1_test.dart ('k') | tests/lib/math/math2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/crypto/sha256_test.dart
diff --git a/tests/lib/crypto/sha256_test.dart b/tests/lib/crypto/sha256_test.dart
index 44c92b1bf51f1cf9f146ff7a88766550e2d9fb4b..62a8dc942d5f13a2d0b97792cdfa551801d870c5 100644
--- a/tests/lib/crypto/sha256_test.dart
+++ b/tests/lib/crypto/sha256_test.dart
@@ -11,7 +11,7 @@ part 'sha256_long_test_vectors.dart';
part 'sha256_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;
}
@@ -278,26 +278,30 @@ void test() {
'3f8591112c6bbe5c963965954e293108b7208ed2af893e500d859368c654eabe' ];
for (var i = 0; i < expected_values.length; i++) {
- var d = new SHA256().update(createTestArr(i)).digest();
+ var hash = new SHA256();
+ hash.add(createTestArr(i));
+ var d = hash.close();
Expect.equals(expected_values[i], CryptoUtils.bytesToHex(d), '$i');
}
}
void testInvalidUse() {
var sha = new SHA256();
- 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 SHA256();
- 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 SHA256().update(inputs[i]).digest();
+ var hash = new SHA256();
+ hash.add(inputs[i]);
+ var d = hash.close();
Expect.equals(mds[i], CryptoUtils.bytesToHex(d), '$i');
}
}
« no previous file with comments | « tests/lib/crypto/sha1_test.dart ('k') | tests/lib/math/math2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698