MCPcopy Create free account
hub / github.com/cucumber/cucumber-cpp / StepManagerTestDouble

Class StepManagerTestDouble

tests/utils/StepManagerTestDouble.hpp:55–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53};
54
55class StepManagerTestDouble : public StepManager {
56public:
57 static void clearSteps() {
58 steps().clear();
59 }
60
61 static steps_type::size_type count() {
62 return steps().size();
63 }
64
65 static step_id_type addStepDefinition(const std::string& stepMatcher) {
66 return addStep(std::make_shared<StepInfoNoOp>(stepMatcher, ""));
67 }
68
69 static step_id_type addStepDefinitionWithId(
70 step_id_type desiredId, const std::string& stepMatcher
71 ) {
72 return addStepDefinitionWithId(desiredId, stepMatcher, "");
73 }
74
75 static step_id_type addStepDefinitionWithId(
76 step_id_type desiredId, const std::string& stepMatcher, const std::string source
77 ) {
78 std::shared_ptr<StepInfo> stepInfo(std::make_shared<StepInfoNoOp>(stepMatcher, source));
79 stepInfo->id = desiredId;
80 return addStep(stepInfo);
81 }
82
83 static step_id_type addPendingStepDefinitionWithId(
84 step_id_type desiredId, const std::string& stepMatcher
85 ) {
86 return addPendingStepDefinitionWithId(desiredId, stepMatcher, 0);
87 }
88
89 static step_id_type addPendingStepDefinitionWithId(
90 step_id_type desiredId, const std::string& stepMatcher, const char* description
91 ) {
92 std::shared_ptr<StepInfo> stepInfo(
93 std::make_shared<StepInfoPending>(stepMatcher, description)
94 );
95 stepInfo->id = desiredId;
96 return addStep(stepInfo);
97 }
98
99 static step_id_type addTableStepDefinitionWithId(
100 step_id_type desiredId, const std::string& stepMatcher, const unsigned short expectedSize
101 ) {
102 std::shared_ptr<StepInfo> stepInfo(
103 std::make_shared<StepInfoWithTableArg>(stepMatcher, expectedSize)
104 );
105 stepInfo->id = desiredId;
106 return addStep(stepInfo);
107 }
108
109 static step_id_type getStepId(const std::string& stepMatcher) {
110 step_id_type id = 0;
111 for (steps_type::const_iterator i = steps().begin(); i != steps().end(); ++i) {
112 const StepInfo& stepInfo = *i->second;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected