Debian Codegraph @

3rdparty/catch2/tests/ExtraTests/X10-FallbackStringifier.cpp

raw symbols SCIP
1
2 // Copyright Catch2 Authors
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE.txt or copy at
5 // https://www.boost.org/LICENSE_1_0.txt)
6
7 // SPDX-License-Identifier: BSL-1.0
8
9 /**\file
10 * Test that the user can define custom fallbackStringifier
11 *
12 * This is done by defining a custom fallback stringifier that prints
13 * out a specific string, and then asserting (to cause stringification)
14 * over a type without stringification support.
15 */
16
17 #include <string>
18
19 // A catch-all stringifier
20 template <typename T>
21 std::string fallbackStringifier(T const&) {
22 return "{ !!! }";
23 }
24
25 #include <catch2/catch_test_macros.hpp>
26
27 struct foo {
28 explicit operator bool() const {
29 return true;
30 }
31 };
32
33 TEST_CASE("aa") {
34 REQUIRE(foo{});
35 }