aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/cpptest.rb
blob: 14989de144a9faf9864cf3bd07cd2ca2c0b07deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Cpptest < Formula
  homepage "http://cpptest.sourceforge.net/"
  url "https://downloads.sourceforge.net/project/cpptest/cpptest/cpptest-1.1.2/cpptest-1.1.2.tar.gz"
  sha1 "c8e69ca98f9b39016c94f1f78659f412ee825049"

  bottle do
    cellar :any
    sha1 "f2133e40791ea80673b2fc1af5025bafcabbf7ea" => :mavericks
    sha1 "411e68bba4a50be0a6f77b02084fc1a04380d500" => :mountain_lion
    sha1 "3f84ffdd46df62b000f5c6c14aa7f43a5c046fef" => :lion
  end

  def install
    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make", "install"
  end

  test do
    (testpath/"test.cpp").write <<-EOS.undent
      #include <assert.h>
      #include <cpptest.h>

      class TestCase: public Test::Suite
      {
      public:
        TestCase() { TEST_ADD(TestCase::test); }
        void test() { TEST_ASSERT(1 + 1 == 2); }
      };

      int main()
      {
        TestCase ts;
        Test::TextOutput output(Test::TextOutput::Verbose);
        assert(ts.run(output));
        return 0;
      }
    EOS
    system ENV.cxx, "test.cpp", "-lcpptest", "-o", "test"
    system "./test"
  end
end