Browse Source

Merge pull request #18 from fasiondog/master

add catch2
ruki 6 years ago
parent
commit
7e1c7f3c67
1 changed files with 24 additions and 0 deletions
  1. 24 0
      packages/c/catch2/xmake.lua

+ 24 - 0
packages/c/catch2/xmake.lua

@@ -0,0 +1,24 @@
+package("catch2")
+
+    set_homepage("https://github.com/catchorg/Catch2")
+    set_description("Catch2 is a multi-paradigm test framework for C++. which also supports Objective-C (and maybe C). ")
+ 
+    add_urls("https://github.com/catchorg/Catch2/archive/v$(version).zip")
+    add_versions("2.9.2", "dc486300de22b0d36ddba1705abb07b9e5780639d824ba172ddf7062b2a1bf8f")
+ 
+    on_install(function (package)
+        os.cp("single_include/catch2", package:installdir("include"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; }
+
+            TEST_CASE("testing the factorial function") {
+                CHECK(factorial(1) == 1);
+                CHECK(factorial(2) == 2);
+                CHECK(factorial(3) == 6);
+                CHECK(factorial(10) == 3628800);
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "catch2/catch.hpp", defines = "CATCH_CONFIG_MAIN "}))
+    end)