nettle: add test
Closes Homebrew/homebrew#35314. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
f557ef47ae
commit
a4daa3edf3
1 changed files with 28 additions and 0 deletions
|
@ -22,4 +22,32 @@ class Nettle < Formula
|
|||
system "make", "install"
|
||||
system "make", "check"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<-EOS.undent
|
||||
#include <nettle/sha1.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
struct sha1_ctx ctx;
|
||||
uint8_t digest[SHA1_DIGEST_SIZE];
|
||||
unsigned i;
|
||||
|
||||
sha1_init(&ctx);
|
||||
sha1_update(&ctx, 4, "test");
|
||||
sha1_digest(&ctx, SHA1_DIGEST_SIZE, digest);
|
||||
|
||||
printf("SHA1(test)=");
|
||||
|
||||
for (i = 0; i<SHA1_DIGEST_SIZE; i++)
|
||||
printf("%02x", digest[i]);
|
||||
|
||||
printf("\\n");
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system ENV.cc, "test.c", "-lnettle", "-o", "test"
|
||||
system "./test"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue