Echo Writes Code

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
#include "crucible/test/scenario.inl"

#include "crucible/test/expect.inl"

namespace crucible
{
  Scenario::Scenario(std::string const &group, std::string const &name, Scenario_Function 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
  {
    try {
      my_function();
      return make_pass();
    } catch (Expect_Failed const &e) {
      return make_fail(e.what());
    }
  }
}