diff options
| author | Xu Cheng | 2014-12-28 23:19:50 +0800 |
|---|---|---|
| committer | Mike McQuaid | 2014-12-28 20:01:55 +0000 |
| commit | 7015739a5b151b1b686ea30d9c09e1e600d3fb25 (patch) | |
| tree | f3414a6dab68fc116ccee8bb3c1857b740c34ee0 /Library | |
| parent | 105c1e79bb0785d23d0796b1df255f2fb8647784 (diff) | |
| download | homebrew-7015739a5b151b1b686ea30d9c09e1e600d3fb25.tar.bz2 | |
nettle: add test
Closes #35314.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
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 |
