// SPDX-FileCopyrightText: 2018 Kitsune Ral // SPDX-License-Identifier: LGPL-2.1-or-later #include "function_traits.h" // Tests for function_traits<> using namespace Quotient; int f_(); static_assert(std::is_same_v, int>, "Test fn_return_t<>"); void f1_(int, float); static_assert(std::is_same_v, float>, "Test fn_arg_t<>"); struct Fo { int operator()(); static constexpr auto l = [] { return 0.0f; }; bool memFn(); void constMemFn() const&; double field; const double field2; }; static_assert(std::is_same_v, int>, "Test return type of function object"); static_assert(std::is_same_v, float>, "Test return type of lambda"); static_assert(std::is_same_v, Fo>, "Test first argument type of member function"); static_assert(std::is_same_v, bool>, "Test return type of member function"); static_assert(std::is_same_v, const Fo&>, "Test first argument type of const member function"); static_assert(std::is_void_v>, "Test return type of const member function"); static_assert(std::is_same_v, double&>, "Test return type of a class member"); static_assert(std::is_same_v, const double&>, "Test return type of a const class member"); struct Fo1 { void operator()(int); }; static_assert(std::is_same_v, int>, "Test fn_arg_t defaulting to first argument"); template static void ft(const std::vector&); static_assert( std::is_same)>, const std::vector&>(), "Test function templates");