2011-06-15 04:57:05 +00:00
|
|
|
class Cunit < Formula
|
2015-08-01 09:35:45 +00:00
|
|
|
desc "Lightweight unit testing framework for C"
|
2015-02-03 10:44:05 +00:00
|
|
|
homepage "http://cunit.sourceforge.net/"
|
|
|
|
url "https://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "f5b29137f845bb08b77ec60584fdb728b4e58f1023e6f249a464efa49a40f214"
|
2015-02-03 10:44:05 +00:00
|
|
|
|
2015-02-03 15:54:59 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-11-19 15:45:31 +00:00
|
|
|
sha256 "63c1d2905cf9214281b8dad71a7d86fcf57d46ccbeb026a43dc73dddac569840" => :yosemite
|
|
|
|
sha256 "4add1b332febce1ba3ee01ab98213be0729f3d2cad14f435f4064fec0273c3cd" => :mavericks
|
|
|
|
sha256 "758213aea9b80d97eb4d30da882933e80e69685ae035ef298f2d39bde84eba06" => :mountain_lion
|
2015-02-03 15:54:59 +00:00
|
|
|
end
|
|
|
|
|
2015-02-03 10:44:05 +00:00
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "libtool" => :build
|
2011-06-15 04:57:05 +00:00
|
|
|
|
|
|
|
def install
|
2015-02-03 10:44:05 +00:00
|
|
|
inreplace "bootstrap", "libtoolize", "glibtoolize"
|
|
|
|
system "sh", "bootstrap", prefix
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "CUnit/Basic.h"
|
|
|
|
|
|
|
|
int noop(void) { return 0; }
|
|
|
|
|
|
|
|
void test42(void) { CU_ASSERT(42 == 42); }
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
CU_pSuite pSuite = NULL;
|
|
|
|
if (CUE_SUCCESS != CU_initialize_registry())
|
|
|
|
return CU_get_error();
|
|
|
|
pSuite = CU_add_suite("Suite_1", noop, noop);
|
|
|
|
if (NULL == pSuite) {
|
|
|
|
CU_cleanup_registry();
|
|
|
|
return CU_get_error();
|
|
|
|
}
|
|
|
|
if (NULL == CU_add_test(pSuite, "test of 42", test42)) {
|
|
|
|
CU_cleanup_registry();
|
|
|
|
return CU_get_error();
|
|
|
|
}
|
|
|
|
CU_basic_set_mode(CU_BRM_VERBOSE);
|
|
|
|
CU_basic_run_tests();
|
|
|
|
CU_cleanup_registry();
|
|
|
|
return CU_get_error();
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
system ENV.cc, "test.c", "-L#{lib}", "-lcunit", "-o", "test"
|
|
|
|
assert_match "test of 42 ...passed", shell_output("./test")
|
2011-06-15 04:57:05 +00:00
|
|
|
end
|
|
|
|
end
|