Echo Writes Code

test_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
#include "crucible/testing/scenario.hpp"

#include "crucible/testing/expect.inl"
#include "crucible/testing/suite.inl"

namespace crucible::testing::test_scenario {
  auto noop() -> void {
  }

  auto fail() -> void {
    EXPECT(false);
  }

  SCENARIO(scenario, accessors) {
    scenario::Scenario const s { "some_group", "some_name", noop };
    EXPECT_EQ(s.get_group(), "some_group");
    EXPECT_EQ(s.get_name(), "some_name");
  }

  SCENARIO(scenario, execute_pass) {
    scenario::Scenario s { "some_group", "some_name", noop };
    auto const outcome { s.execute() };
    EXPECT(outcome.passed());
  }

  SCENARIO(scenario, execute_fail) {
    scenario::Scenario s { "some_group", "some_name", fail };
    auto const outcome { s.execute() };
    EXPECT(outcome.failed());
  }
}