2013-01-15 13:42:51 +00:00
|
|
|
class Cmocka < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Unit testing framework for C"
|
2015-02-26 16:47:29 +00:00
|
|
|
homepage "https://cmocka.org/"
|
|
|
|
url "https://cmocka.org/files/1.0/cmocka-1.0.0.tar.xz"
|
|
|
|
sha1 "c1b6bdab164b2d54c26edacef9b9308e4de154f9"
|
2013-01-15 13:42:51 +00:00
|
|
|
|
2015-03-01 05:09:40 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "7ce09408d9d5d7b08c19dd7d483058c9fd6bd9fa" => :yosemite
|
|
|
|
sha1 "d9f4f45dd1338eaf3b19d42fc3b5b88f538c997d" => :mavericks
|
|
|
|
sha1 "4e365b5ba01862722e3d91e1c1cdc8d34c6e3e34" => :mountain_lion
|
|
|
|
end
|
|
|
|
|
2015-02-26 16:47:29 +00:00
|
|
|
depends_on "cmake" => :build
|
2013-01-15 13:42:51 +00:00
|
|
|
|
|
|
|
def install
|
2015-02-26 16:47:29 +00:00
|
|
|
mkdir "build" do
|
2013-01-15 13:42:51 +00:00
|
|
|
system "cmake", "..", "-DUNIT_TESTING=On", *std_cmake_args
|
|
|
|
system "make"
|
2015-02-26 16:47:29 +00:00
|
|
|
system "make", "install"
|
2013-01-15 13:42:51 +00:00
|
|
|
end
|
|
|
|
end
|
2015-02-26 16:47:29 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <cmocka.h>
|
|
|
|
|
|
|
|
static void null_test_success(void **state) {
|
|
|
|
(void) state; /* unused */
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
const struct CMUnitTest tests[] = {
|
|
|
|
cmocka_unit_test(null_test_success),
|
|
|
|
};
|
|
|
|
return cmocka_run_group_tests(tests, NULL, NULL);
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lcmocka", "-o", "test"
|
|
|
|
system "./test"
|
|
|
|
end
|
2013-01-15 13:42:51 +00:00
|
|
|
end
|