scenario.cpp
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
#include "crucible/test/scenario.hpp" #include "crucible/test/expect.hpp" #include "crucible/test/outcome.hpp" #include "crucible/test/suite.hpp" namespace crucible::test::scenario { Scenario::Scenario(std::string const &group, std::string const &name, ScenarioFunction const &function) : my_group { group }, my_name { name }, my_function { function } {} auto Scenario::get_group() const -> std::string { return my_group; } auto Scenario::get_name() const -> std::string { return my_name; } auto Scenario::execute() const -> outcome::Outcome { try { my_function(); return outcome::make_pass(); } catch (expect::ExpectFailed const &e) { return outcome::make_fail(e.what()); } } }