based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

invoke_result_test.cpp (676B)


0 #define CATCH_CONFIG_RUNTIME_STATIC_REQUIRE
2 #include "based/trait/invoke_result.hpp"
4 #include <catch2/catch_test_macros.hpp>
6 #include "based/concepts/is/same.hpp"
8 namespace
9 {
11 // NOLINTNEXTLINE(*needed*)
12 int func(double);
14 } // namespace
16 template<class Res, class T, class... Args>
17 concept test = based::SameAs<based::invoke_result_t<T, Args...>, Res>;
19 TEST_CASE("invoke_result", "[trait/invoke_result]")
20 {
21 // NOLINTBEGIN(*array*)
22 // clang-format off
24 STATIC_REQUIRE(test<int, decltype(func), double>);
25 STATIC_REQUIRE(test<int, decltype(func), int>);
26 STATIC_REQUIRE(!test<int, decltype(func), decltype(func)>);
28 // clang-format on
29 // NOLINTEND(*array*)
30 }