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

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

Issue 10134055: Add common interface for cryptographic hash functions to lib/crypto.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. 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 | « lib/crypto/sha_utils.dart ('k') | tests/lib/src/crypto/sha256Test.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 9d23fd8999cfb9be0755d8375485fc198cfd9cbf..5d1fae4b66a0e04cc9bbdc8a51d217be53f08122 100644
--- a/tests/lib/src/crypto/sha1Test.dart
+++ b/tests/lib/src/crypto/sha1Test.dart
@@ -21,7 +21,7 @@ String digestToString(List<int> digest) {
return buf.toString();
}
-void testStatic() {
+void test() {
final expected_values = const [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"5ba93c9db0cff93f52b521d7420e43f6eda2784f",
@@ -538,10 +538,20 @@ void testStatic() {
];
for (var i = 0; i < expected_values.length; i++) {
Expect.equals(expected_values[i],
- digestToString(SHA1.digest(createTestArr(i))));
+ digestToString(new SHA1().update(createTestArr(i)).digest()));
}
}
+void testInvalidUse() {
+ var sha = new SHA1();
+ sha.digest();
+ Expect.throws(sha.digest,
+ (e) => e is CryptoHashException);
+ Expect.throws(() => sha.update([0]),
+ (e) => e is CryptoHashException);
+}
+
void main() {
- testStatic();
+ test();
+ testInvalidUse();
}
« no previous file with comments | « lib/crypto/sha_utils.dart ('k') | tests/lib/src/crypto/sha256Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698