| 61 | #define PENDING_DESCRIPTION "Describe me!" |
| 62 | |
| 63 | class DriverTest { |
| 64 | public: |
| 65 | int run() { |
| 66 | runAllTests(); |
| 67 | return failedTests; |
| 68 | } |
| 69 | |
| 70 | DriverTest() { |
| 71 | failedTests = 0; |
| 72 | } |
| 73 | |
| 74 | virtual ~DriverTest() = default; |
| 75 | |
| 76 | protected: |
| 77 | void expectTrue(const char* description, bool condition) { |
| 78 | updateState(description, condition); |
| 79 | } |
| 80 | |
| 81 | void expectFalse(const char* description, bool condition) { |
| 82 | updateState(description, !condition); |
| 83 | } |
| 84 | |
| 85 | template<typename T> |
| 86 | void expectEqual(const char* description, T val1, T val2) { |
| 87 | updateState(description, val1 == val2); |
| 88 | } |
| 89 | |
| 90 | void expectStrEqual(const char* description, const char* val1, const char* val2) { |
| 91 | updateState(description, strcmp(val1, val2) == 0); |
| 92 | } |
| 93 | |
| 94 | virtual void runAllTests() { |
| 95 | invokeRunsTests(); |
| 96 | contextConstructorAndDesctructorGetCalled(); |
| 97 | failureDescriptionIsResetOnEachRun(); |
| 98 | } |
| 99 | |
| 100 | CukeCommands cukeCommands; |
| 101 | |
| 102 | private: |
| 103 | typedef StepManagerTestDouble StepManager; |
| 104 | ContextListener listener; |
| 105 | |
| 106 | int failedTests; |
| 107 | |
| 108 | void updateState(const char* description, bool testSuccessState) { |
| 109 | std::cout << (testSuccessState ? "SUCCESS" : "FAILURE") << " (" << description << ")" |
| 110 | << std::endl; |
| 111 | failedTests += testSuccessState ? 0 : 1; |
| 112 | } |
| 113 | |
| 114 | step_id_type getStepIdFromMatcher(const std::string& stepMatcher) { |
| 115 | return StepManager::getStepId(stepMatcher); |
| 116 | } |
| 117 | |
| 118 | void invokeRunsTests() { |
| 119 | std::cout << "= Step invocation =" << std::endl; |
| 120 | |