fixture.inl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef CRUCIBLE_TEST_FIXTURE_INL #define CRUCIBLE_TEST_FIXTURE_INL #include "crucible/test/expect.hpp" namespace crucible::test::fixture { template<typename DERIVED> FixtureVariant<DERIVED>::FixtureVariant(FixtureFunction const &function) : my_function { function } {} template<typename DERIVED> auto FixtureVariant<DERIVED>::get_name() const -> std::string { return DERIVED::name; } template<typename DERIVED> auto FixtureVariant<DERIVED>::execute() -> outcome::Outcome { try { my_function(); return outcome::make_pass(); } catch (expect::ExpectFailed const &e) { return outcome::make_fail(e.what()); } } template<typename VARIANT> Fixture::Fixture(std::string const &group, std::string const &name, VARIANT const &variant) : my_group { group }, my_name { name }, my_variant { variant } {} template<typename VARIANT> auto Fixture::has_variant() const -> bool { return std::holds_alternative<VARIANT>(my_variant); } } #endif // CRUCIBLE_TEST_FIXTURE_INL