MCPcopy Create free account
hub / github.com/boost-ext/ut / main

Function main

example/BDD.cpp:10–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <boost/ut.hpp>
9
10int main() {
11 using namespace boost::ut::literals;
12 using namespace boost::ut::operators::terse;
13 using namespace boost::ut::bdd;
14
15 "Scenario"_test = [] {
16 given("I have...") = [] {
17 when("I run...") = [] {
18 then("I should have...") = [] { 1_u == 1u; };
19 then("I should have...") = [] { 1u == 1_u; };
20 };
21 };
22 };
23
24 feature("Calculator") = [] {
25 scenario("Addition") = [] {
26 given("I have number 40") = [] {
27 auto number = 40;
28 when("I add 2 to number") = [&number] { number += 2; };
29 then("I expect number to be 42") = [&number] { 42_i == number; };
30 };
31 };
32 };
33
34 // clang-format off
35 scenario("Addition");
36 given("I have number 40");
37 auto number = 40;
38
39 when("I add 2 to number");
40 number += 2;
41
42 then("I expect number to be 42");
43 42_i == number;
44 // clang-format on
45}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected