diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/nettle.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Library/Formula/nettle.rb b/Library/Formula/nettle.rb index 268993b3b..7df222885 100644 --- a/Library/Formula/nettle.rb +++ b/Library/Formula/nettle.rb @@ -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 |
