test/libapt/hashsums_test.cc: add a test for HashString and VerifyFile
authorMichael Vogt <michael.vogt@ubuntu.com>
Fri, 29 Jul 2011 14:33:20 +0000 (16:33 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Fri, 29 Jul 2011 14:33:20 +0000 (16:33 +0200)
test/libapt/hashsums_test.cc

index ff15367..2cb71cc 100644 (file)
@@ -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;
 }