summaryrefslogtreecommitdiff
path: root/test/libapt/hashsums_test.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-29 16:33:20 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-29 16:33:20 +0200
commite99a544c8c48d8067d008b5c7e4e1d5479529ce2 (patch)
tree666257e5f2a9996e25ff8fb50b7a82ad17332242 /test/libapt/hashsums_test.cc
parent6f33ec4884b6d77e499bb3885aeec14c74943871 (diff)
test/libapt/hashsums_test.cc: add a test for HashString and VerifyFile
Diffstat (limited to 'test/libapt/hashsums_test.cc')
-rw-r--r--test/libapt/hashsums_test.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index ff1536718..2cb71cc38 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -135,6 +135,21 @@ int main(int argc, char** argv)
equals(argv[5], sha2.Result().Value());
}
fclose(fd);
+
+ // test HashString code
+ {
+ HashString sha2("SHA256", argv[4]);
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+ {
+ HashString sha2("SHA512", argv[5]);
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+ {
+ HashString sha2("SHA256:"+string(argv[4]));
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+
return 0;
}