Skip to content

Commit

Permalink
beecrypt: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats authored and tdsmith committed May 5, 2015
1 parent 412b623 commit fc0b656
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions Formula/beecrypt.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "formula"

class Beecrypt < Formula
homepage "http://beecrypt.sourceforge.net"
url "https://downloads.sourceforge.net/project/beecrypt/beecrypt/4.2.1/beecrypt-4.2.1.tar.gz"
Expand All @@ -26,8 +24,34 @@ def install
"--without-java",
"--without-python"
system "make"
system "make check"
system "make install"
system "make", "check"
system "make", "install"
end

test do
(testpath/"test.c").write <<-EOS.undent
#include "beecrypt/base64.h"
#include "beecrypt/sha256.h"
#include <stdio.h>
int main(void)
{
sha256Param hash;
const byte *string = (byte *) "abc";
byte digest[32];
sha256Reset(&hash);
sha256Update(&hash, string, sizeof(string) / sizeof(*string));
sha256Process(&hash);
sha256Digest(&hash, digest);
printf("%s\\n", b64crc(digest, 32));
return 0;
}
EOS
system ENV.cc, "test.c", "-lbeecrypt", "-o", "test"
assert_match /ZF8D/, shell_output("./test")
end
end

Expand Down

0 comments on commit fc0b656

Please sign in to comment.