Sequoia
Loading...
Searching...
No Matches
TestUtilities.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2018. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
14namespace sequoia::testing
15{
17 {
18 public:
19 constexpr explicit no_default_constructor(int i) : m_i{i} {}
20
21 [[nodiscard]]
22 constexpr int get() const noexcept { return m_i; }
23
24 [[nodiscard]]
25 constexpr friend bool operator==(const no_default_constructor&, const no_default_constructor&) noexcept = default;
26 private:
27 int m_i{};
28 };
29}
30
31namespace std {
32 template<>
33 struct formatter<sequoia::testing::no_default_constructor>
34 {
35 constexpr auto parse(auto& ctx) { return ctx.begin(); }
36
37 auto format(const sequoia::testing::no_default_constructor& ndc, auto& ctx) const
38 {
39 return std::format_to(ctx.out(), "{}", ndc.get());
40 }
41 };
42}
Definition: TestUtilities.hpp:17