// SPDX-FileCopyrightText: 2021 Kitsune Ral // SPDX-License-Identifier: LGPL-2.1-or-later #include "omittable.h" #include // compile-time Omittable<> tests using namespace Quotient; Omittable testFn(bool) { return 0; } bool testFn2(int) { return false; } static_assert( std::is_same_v>().then(testFn)), Omittable>); static_assert( std::is_same_v< decltype(std::declval>().then_or(testFn, 0)), int>); static_assert( std::is_same_v>().then(testFn)), Omittable>); static_assert(std::is_same_v>() .then(testFn2) .then(testFn)), Omittable>); static_assert(std::is_same_v>() .then(testFn) .then_or(testFn2, false)), bool>); constexpr auto visitTestFn(int, bool) { return false; } static_assert( std::is_same_v, decltype(lift(testFn2, Omittable()))>); static_assert(std::is_same_v, decltype(lift(visitTestFn, Omittable(), Omittable()))>); class TestUtils : public QObject { Q_OBJECT private Q_SLOTS: // TODO }; QTEST_APPLESS_MAIN(TestUtils) #include "utiltests.moc"