From 52c527a2eab4af860a47b6c76fd632df0689e655 Mon Sep 17 00:00:00 2001 From: star-hengxing Date: Tue, 14 Feb 2023 11:08:42 +0800 Subject: [PATCH] add ut --- packages/u/ut/xmake.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packages/u/ut/xmake.lua diff --git a/packages/u/ut/xmake.lua b/packages/u/ut/xmake.lua new file mode 100644 index 000000000..ba5a1fc38 --- /dev/null +++ b/packages/u/ut/xmake.lua @@ -0,0 +1,34 @@ +package("ut") + set_kind("library", {headeronly = true}) + set_homepage("https://boost-ext.github.io/ut/") + set_description("UT: C++20 μ(micro)/Unit Testing Framework") + set_license("BSL-1.0") + + add_urls("https://github.com/boost-ext/ut/archive/refs/tags/$(version).tar.gz") + add_urls("https://github.com/boost-ext/ut.git") + add_versions("v1.1.9", "1a666513157905aa0e53a13fac602b5673dcafb04a869100a85cd3f000c2ed0d") + + add_configs("modules", {description = "Enable C++20 modules", default = false, type = "boolean", readonly = true}) + + on_install("windows", "linux", "macosx", function (package) + os.cp("include", package:installdir()) + if not package:config("modules") then + package:add("defines", "BOOST_UT_DISABLE_MODULE") + end + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + constexpr auto sum(auto... values) { return (values + ...); } + + void test() { + using namespace boost::ut; + + "sum"_test = [] { + expect(sum(0) == 0_i); + expect(sum(1, 2) == 3_i); + expect(sum(1, 2) > 0_i and 41_i == sum(40, 2)); + }; + } + ]]}, {configs = {languages = "c++20", defines = "BOOST_UT_DISABLE_MODULE"}, includes = "boost/ut.hpp"})) + end)