diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3c0ffc48..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "features/cucumber-tck"] - path = features/cucumber-tck - url = https://github.com/cucumber/cucumber-tck.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c27d8bf..6c34f1cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,6 @@ option(CUKE_ENABLE_BOOST_TEST "Enable Boost.Test framework" ON) option(CUKE_ENABLE_EXAMPLES "Build examples" OFF) option(CUKE_ENABLE_GTEST "Enable Google Test framework" ON) option(CUKE_ENABLE_QT "Enable Qt framework" ON) -option(CUKE_TESTS_E2E "Enable end-to-end tests" ON) option(CUKE_TESTS_UNIT "Enable unit tests" ON) option(CUKE_CODE_COVERAGE "Enable instrumentation for code coverage" OFF) set(CUKE_ENABLE_SANITIZER "OFF" CACHE STRING "Sanitizer to use for checking") @@ -70,7 +69,6 @@ endfunction() option_depr_invert (CUKE_DISABLE_BOOST_TEST CUKE_ENABLE_BOOST_TEST) option_depr_invert (CUKE_DISABLE_GTEST CUKE_ENABLE_GTEST) option_depr_invert (CUKE_DISABLE_QT CUKE_ENABLE_QT) -option_depr_invert (CUKE_DISABLE_E2E_TESTS CUKE_TESTS_E2E) option_depr_invert (CUKE_DISABLE_UNIT_TESTS CUKE_TESTS_UNIT) option_depr (VALGRIND_TESTS CUKE_TESTS_VALGRIND) @@ -313,71 +311,6 @@ else() message(STATUS "Skipping unit tests") endif() -if(NOT CUKE_TESTS_E2E) - message(STATUS "Skipping end-to-end tests") -else() - find_program(CUCUMBER_RUBY cucumber) - if(CUCUMBER_RUBY) - message(STATUS "Found Cucumber") - set(CUKE_FEATURES_DIR "${CMAKE_SOURCE_DIR}/features") - set(CUKE_FEATURES_TMP "${CMAKE_BINARY_DIR}/tmp") - set(CUKE_TEST_FEATURES_DIR "${CUKE_FEATURES_TMP}/test_features") - set(CUKE_DYNAMIC_CPP_STEPS "${CUKE_TEST_FEATURES_DIR}/step_definitions/cpp_steps.cpp") - string(REPLACE "/tmp" "${CMAKE_FILES_DIRECTORY}/e2e-steps.dir/tmp" CUKE_DYNAMIC_CPP_STEPS_OBJ "${CUKE_DYNAMIC_CPP_STEPS}${CMAKE_CXX_OUTPUT_EXTENSION}") - - add_executable(e2e-steps EXCLUDE_FROM_ALL ${CUKE_DYNAMIC_CPP_STEPS}) - # Mark this file as generated so it isn't required at CMake generation time (it is necessary when the target gets built though) - set_source_files_properties(${CUKE_DYNAMIC_CPP_STEPS} PROPERTIES GENERATED TRUE) - target_link_libraries(e2e-steps PRIVATE cucumber-cpp) - #Boost test lib required for boost specific scenario "Predicate Message" - if(TARGET Boost::unit_test_framework) - target_link_libraries(e2e-steps PRIVATE Boost::unit_test_framework) - else() - set(CUKE_E2E_TAGS "--tags ~@boost") - endif() - - set(CUKE_COMPILE_DYNAMIC_CPP_STEPS '"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target e2e-steps') - - function(add_feature_target TARGET_NAME) - # Ensure we get colored output from cucumber and give it direct terminal access if - # possible. Direct terminal access would cause the output to be displayed as it's being - # produced instead of when cucumber is finished. - if(CMAKE_GENERATOR STREQUAL "Ninja") - list(APPEND ARGN --color) - endif() - set(USES_TERMINAL) - if(NOT CMAKE_VERSION VERSION_LESS 3.2) - set(USES_TERMINAL USES_TERMINAL) - endif() - add_custom_target(${TARGET_NAME} - COMMAND ${CUCUMBER_RUBY} - TEST_FEATURES_DIR=${CUKE_TEST_FEATURES_DIR} - TMP_DIR=${CUKE_FEATURES_TMP} - DYNAMIC_CPP_STEPS_SRC=${CUKE_DYNAMIC_CPP_STEPS} - DYNAMIC_CPP_STEPS_EXE=${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/e2e-steps - DYNAMIC_CPP_STEPS_OBJ=${CUKE_DYNAMIC_CPP_STEPS_OBJ} - COMPILE_DYNAMIC_CPP_STEPS=${CUKE_COMPILE_DYNAMIC_CPP_STEPS} - CUCUMBER_RUBY=${CUCUMBER_RUBY} - --format=junit "--out=${CMAKE_BINARY_DIR}/features" - ${CUKE_E2E_TAGS} - ${ARGN} - ${CUKE_FEATURES_DIR} - ${USES_TERMINAL} - # Execute in same directory as where DLLs appear on Windows - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src - ) - endfunction(add_feature_target) - - add_feature_target(features --format progress) - add_feature_target(features-pretty --format pretty) - add_feature_target(features-wip --format pretty --tags @wip) - - else() - message(WARNING "Could not find Cucumber: skipping end-to-end tests") - endif() - -endif() - # # Examples # diff --git a/Gemfile b/Gemfile index dacfc800..d53a1beb 100644 --- a/Gemfile +++ b/Gemfile @@ -3,9 +3,5 @@ source 'https://rubygems.org' group :test do gem 'cucumber', "=7.1.0" gem 'cucumber-wire', "=6.2.1" - gem 'aruba', ">=0.8.0" - gem 'rspec', ">=3.4.0" - gem 'childprocess', ">=0.5.9" - gem 'ffi', ">=1.9.25" end diff --git a/README.md b/README.md index 66f6e7b3..4426eb7b 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,6 @@ bundle install Building Cucumber-Cpp with tests and samples: ``` -# Download test suite -git submodule init -git submodule update - # Create build directory cmake -E make_directory build @@ -75,9 +71,6 @@ cmake --build build --target test # Run install cmake --build build --target install - -# Check implementation against common cucumber test suite -cmake --build build --target features ``` Running the Calc example on Unix: diff --git a/features/cucumber-tck b/features/cucumber-tck deleted file mode 160000 index 11d6379b..00000000 --- a/features/cucumber-tck +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 11d6379b9096f6aa9920e2861bd0530ca7c6302b diff --git a/features/specific/boost_specific.feature b/features/specific/boost_specific.feature deleted file mode 100644 index c27f0097..00000000 --- a/features/specific/boost_specific.feature +++ /dev/null @@ -1,34 +0,0 @@ -@boost -Feature: Check macros used with boost test driver - - This is just a simple feature meant to test boost's - specyfic validation macros interop with cucumber. - - Scenario Outline: macro - Given the following feature: - """ - Feature: Feature name - Scenario: Scenario name - Given a step - """ - And a step definition file with: - """ - #include - #include - GIVEN("a step") { - ; - } - """ - When Cucumber runs the feature - Then the scenario - - Examples: - | check | passes or fails? | - | BOOST_CHECK(false) | fails | - | BOOST_CHECK_MESSAGE(false, "boost message") | fails with message "boost message" | - | BOOST_ERROR("boost message") | fails with message "boost message" | - | BOOST_FAIL("boost message") | fails with message "boost message" | - | BOOST_REQUIRE(false) | fails | - | BOOST_REQUIRE_MESSAGE(false, "boost message") | fails with message "boost message" | - | BOOST_WARN(false) | passes | - | BOOST_WARN_MESSAGE(false, "boost message") | passes | diff --git a/features/specific/escaping.feature b/features/specific/escaping.feature deleted file mode 100644 index 783d4fa5..00000000 --- a/features/specific/escaping.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: Escaping - -In order to copy and paste the undefined steps snippets -As a developer -I want the regex string to be correctly escaped - -Scenario Outline: in step definition - Given a scenario with: - """ - Given the step contains '' - """ - And the steps have no mappings - When Cucumber executes the scenario - Then a step definition snippet with "^the step contains ''$" is suggested - - # Remember that in Gherkin's data tables: - # \n -> newline - # \| -> | - # \\ -> \ - # \ -> - # - # Unfortunately the behaviour is just odd when chaining backslashes: - # \\\\\\. -> \\. (most common case) - # \\\\\\\\+ -> \\+ - # \\\\\\\\\\\\\\ -> \\\\ - - Examples: - | characters | scenario step string | step definition string | - | Double quotes | " | \\" | - | Backslash | \\ | \\\\\\\\\\\\\\ | - | Dot | . | \\\\\\. | - | Caret | ^ | \\\\\\^ | - | Dollar | $ | \\\\\\$ | - | Asterisk | * | \\\\\\* | - | Plus | + | \\\\\\\\+ | - | Question mark | ? | \\\\\\? | - | Brackets | ( ) | \\\\\\( \\\\\\) | - | Square brackets | [ ] | \\\\\\[ \\\\\\] | - | Curly brackets | { } | \\\\\\{ \\\\\\} | - | Pipe | \| | \\\\\\\| | diff --git a/features/specific/simple.feature b/features/specific/simple.feature deleted file mode 100644 index 51e754f2..00000000 --- a/features/specific/simple.feature +++ /dev/null @@ -1,28 +0,0 @@ -Feature: Simple Feature - - This is just a simple feature meant to test the infrastructure. - The features in this directory should test code specific to - Cucumber-Cpp, like how to write hooks, the test frameworks, etc. - - Scenario: Simple Scenario - Given the following feature: - """ - Feature: Feature name - - Scenario: Scenario name - Given a step - """ - And a step definition file with support code including: - """ - #include - - GIVEN("a step") { - std::cout << "STEP RUN" << std::endl; - } - """ - When Cucumber runs the feature - Then the step output should contain: - """ - STEP RUN - - """ diff --git a/features/specific/wire_encoding.feature b/features/specific/wire_encoding.feature deleted file mode 100644 index 27effcbf..00000000 --- a/features/specific/wire_encoding.feature +++ /dev/null @@ -1,30 +0,0 @@ -Feature: Wire Encoding Feature - - This is just a simple feature meant to test - transmission of UTF-8 over the WireProtocol. - - Scenario: Multibyte Character Step Matching - Given the following feature: - """ - Feature: Match Regex With Multibyte Character String - - Scenario: Match Regex - Given a step which uses regex to match the following text: 'カラオケ機' and 'ASCII' - """ - And a step definition file with support code including: - """ - #include - #include - - GIVEN("a step which uses regex to match the following text: '(.+)' and '(.+)'") { - REGEX_PARAM(std::string, Match1); - REGEX_PARAM(std::string, Match2); - std::cout << Match1 << Match2 << std::endl; - } - """ - When Cucumber runs the feature - Then the step output should contain: - """ - カラオケ機ASCII - - """ diff --git a/features/step_definitions/RpnCalculatorSteps.cpp b/features/step_definitions/RpnCalculatorSteps.cpp deleted file mode 100644 index 688b7801..00000000 --- a/features/step_definitions/RpnCalculatorSteps.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include - -using cucumber::ScenarioScope; -using std::string; - -namespace { - -bool isCloseEnough(double value, double expected) { - return (std::abs(value - expected) > 0.00001); -} - -void verifyEqual(double value, double expected) { - if (isCloseEnough(value, expected)) { - throw(boost::format("Value %1% not equal to %2%") % value % expected).str(); - } -} - -void verifyNotEqual(double value, double expected) { - if (!isCloseEnough(value, expected)) { - throw(boost::format("Value %1% equal to %2%") % value % expected).str(); - } -} -} - -GIVEN("^a calculator") { - // nothing to do -} - -WHEN("^the calculator computes PI$") { - ScenarioScope calc; - calc->pi(); -} - -WHEN("^the calculator adds up ([\\d\\.]+) and ([\\d\\.]+)$") { - REGEX_PARAM(string, n1); - REGEX_PARAM(string, n2); - - ScenarioScope calc; - calc->push(n1); - calc->push(n2); - calc->push("+"); -} - -WHEN("^the calculator adds up \"([^\"]*)\" and \"([^\"]*)\"$") { - REGEX_PARAM(string, n1); - REGEX_PARAM(string, n2); - - ScenarioScope calc; - calc->push(n1); - calc->push(n2); - calc->push("+"); -} - -WHEN("^the calculator adds up \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\"$") { - REGEX_PARAM(string, n1); - REGEX_PARAM(string, n2); - REGEX_PARAM(string, n3); - - ScenarioScope calc; - calc->push(n1); - calc->push(n2); - calc->push(n3); - calc->push("+"); - calc->push("+"); -} - -WHEN("^the calculator adds up the following numbers:$") { - REGEX_PARAM(string, numberString); - - ScenarioScope calc; - vector numbers; - boost::split(numbers, numberString, boost::is_any_of("\n")); - - for (size_t i = 0; i < numbers.size(); ++i) { - calc->push(numbers[i]); - if (i != 0) { - calc->push("+"); - } - } -} - -THEN("^the calculator returns PI$") { - ScenarioScope calc; - verifyEqual(calc->value(), boost::math::constants::pi()); -} - -THEN("^the calculator returns \"([^\"]*)\"$") { - REGEX_PARAM(double, expected); - - ScenarioScope calc; - verifyEqual(calc->value(), expected); -} - -THEN("^the calculator does not return ([\\d\\.]+)$") { - REGEX_PARAM(double, expected); - - ScenarioScope calc; - verifyNotEqual(calc->value(), expected); -} diff --git a/features/step_definitions/cucumber_cpp_mappings.rb b/features/step_definitions/cucumber_cpp_mappings.rb deleted file mode 100644 index a64deb1a..00000000 --- a/features/step_definitions/cucumber_cpp_mappings.rb +++ /dev/null @@ -1,332 +0,0 @@ -require 'json' - -module CucumberCppMappings - - def features_dir - FEATURES_DIR - end - - def write_passing_mapping(step_name) - append_step_definition(step_name, '// no-op, pass gently') - end - - def write_failing_mapping(step_name) - write_failing_mapping_with_message(step_name, "rotten cucumbers") - end - - def write_failing_mapping_with_message(step_name, message) - append_step_definition(step_name, "throw \"#{message}\";") - end - - def write_pending_mapping(step_name) - append_step_definition(step_name, "pending();") - end - - def write_calculator_code - include_file "../support/RpnCalculator.cpp" - end - - def write_mappings_for_calculator - include_file "RpnCalculatorSteps.cpp" - end - - def write_mapping_receiving_data_table_as_headless_row_array(step_name) - not_implemented - end - - def write_mapping_receiving_data_table_as_raw(step_name) - not_implemented - end - - def write_mapping_receiving_data_table_as_hashes(step_name) - append_step_definition step_name, <<-EOF -TABLE_PARAM(table); -logTableAsHashes(table); -EOF - end - - def write_passing_hook options = {} - log_string = options[:log_cycle_event_as] - if options[:type] - hook_type = options[:type] - log_string ||= hook_type - else - hook_type = "before" - log_string ||= "hook" - end - tags = options[:tags] || [] - define_hook = hook_type.upcase - params = tags.any? ? '"'+tags.join('", "')+'"' : "" - - if hook_type == "around" - # around scenario hooks not implemented - not_implemented - else - append_support_code <<-EOF -#{define_hook}(#{params}) { - logCycleEvent("#{log_string}"); -} -EOF - end - end - - def write_scenario options = {} - tags = options[:with_tags] || [] - - @next_step_count ||= 0 - step_name = nth_step_name @next_step_count += 1 - tags_definition = tags.any? ? "\n #{tags.join(' ')}" : "" - append_logging_step_definition(step_name) - append_to_feature <<-EOF -#{tags_definition} - Scenario: scenario #{"tagged with " + tags.join(', ') if tags.any?} - Given #{step_name} -EOF - end - - def write_world_variable_with_numeric_value(value) - append_support_code <<-EOF -struct World { - int variable; - World() : variable(#{value}) {} -}; -EOF - end - - def write_world_function - append_support_code <<-EOF -struct World { - void someFunction() { - writeToFile("#{WORLD_FUNCTION_LOG_FILE}", ""); - } -}; -EOF - end - - def write_custom_world_constructor - # it does not make any sense! the scenario should be changed - end - - def write_mapping_incrementing_world_variable_by_value(step_name, increment_value) - append_step_definition step_name, <<-EOF -ScenarioScope world; - -world->variable += #{increment_value}; -EOF - end - - def write_mapping_logging_world_variable_value(step_name, time = "1") - append_step_definition step_name, <<-EOF -ScenarioScope world; - -writeToFile("#{WORLD_VARIABLE_LOG_FILE}.#{time}", world->variable); -EOF - end - - def write_mapping_calling_world_function(step_name) - append_step_definition step_name, <<-EOF -ScenarioScope world; - -world->someFunction(); -EOF - end - - def assert_passing_scenario - assert_partial_output("1 scenario (1 passed)", all_output) - assert_success true - end - - def assert_failing_scenario - assert_partial_output("1 scenario (1 failed)", all_output) - assert_success false - end - - def assert_pending_scenario - assert_partial_output("1 scenario (1 pending)", all_output) - assert_success true - end - - def assert_undefined_scenario - assert_partial_output("1 scenario (1 undefined)", all_output) - assert_success true - end - - def assert_scenario_reported_as_failing(scenario_name) - assert_partial_output("# Scenario: #{scenario_name}", all_output) - assert_success false - end - - def assert_scenario_not_reported_as_failing(scenario_name) - assert_no_partial_output("# Scenario: #{scenario_name}", all_output) - end - - def assert_suggested_step_definition_snippet(stepdef_keyword, stepdef_pattern, parameter_count = 0, doc_string = false, data_table = false) - not_implemented - end - - def assert_executed_scenarios *scenario_offsets - sequence = scenario_offsets.inject([]) do |sequence, scenario_offset| - sequence << nth_step_name(scenario_offset) - end - assert_complete_cycle_sequence *sequence - end - - def assert_world_variable_held_value_at_time(value, time) - expect("#{WORLD_VARIABLE_LOG_FILE}.#{time}").to have_file_content(value) - end - - def assert_world_function_called - expect(WORLD_FUNCTION_LOG_FILE).to be_an_existing_file - end - - def assert_cycle_sequence *args - expected_string = args.join CYCLE_SEQUENCE_SEPARATOR - expect(CYCLE_LOG_FILE).to have_file_content(Regexp.new expected_string) - end - - def assert_cycle_sequence_excluding *args - args.each do |unexpected_string| - expect(CYCLE_LOG_FILE).not_to have_file_content(unexpected_string) - end - end - - def assert_complete_cycle_sequence *args - expected_string = "#{CYCLE_SEQUENCE_SEPARATOR}#{args.join(CYCLE_SEQUENCE_SEPARATOR)}" - expect(CYCLE_LOG_FILE).to have_file_content(expected_string) - end - - def assert_data_table_equals_json(json) - log_file_contents = IO.read(DATA_TABLE_LOG_FILE) - actual_array = JSON.parse(log_file_contents) - expected_array = JSON.parse(json) - expect(actual_array).to be == expected_array - end - - def run_feature - run_feature_with_params("") - end - - def run_feature_with_tags *tag_groups - params = "" - tag_groups.each do |tag_group| - params += " --tags #{tag_group}" - end - run_feature_with_params(params) - end - - def failed_output - "failed" - end - -# cpp steps - - def append_step_definition(step_name, code) # todo params parameter? - append_support_code <<-EOF -CUKE_STEP_("^#{step_name}$") { -#{indent_code code} -} -EOF - end - - def set_code(code) - @support_code = code - end - - def append_support_code(code) - helper_functions = get_absolute_path('../support/HelperFunctions.hpp'); - @support_code ||= <<-EOF -#include -#include "#{helper_functions}" - -using cucumber::ScenarioScope; - -void logCycleEvent(const char *name) { - logCycleEvent(name, "#{CYCLE_LOG_FILE}", "#{CYCLE_SEQUENCE_SEPARATOR}"); -} - -void logTableAsHashes(const cucumber::internal::Table & table) { - logTableAsHashes(table, "#{DATA_TABLE_LOG_FILE}"); -} -EOF - @support_code += code - end - - TMP_DIR = ENV["TMP_DIR"] - FEATURES_DIR = ENV["TEST_FEATURES_DIR"] - STEP_DEFINITIONS_SRC = ENV["DYNAMIC_CPP_STEPS_SRC"] - STEP_DEFINITIONS_OBJ = ENV["DYNAMIC_CPP_STEPS_OBJ"] - STEP_DEFINITIONS_EXE = ENV["DYNAMIC_CPP_STEPS_EXE"] - COMPILE_STEP_DEFINITIONS_CMD = ENV["COMPILE_DYNAMIC_CPP_STEPS"] - CUCUMBER_RUBY = ENV["CUCUMBER_RUBY"] - - WORLD_VARIABLE_LOG_FILE = "#{TMP_DIR}/world_variable.log" - WORLD_FUNCTION_LOG_FILE = "#{TMP_DIR}/world_function.log" - DATA_TABLE_LOG_FILE = "#{TMP_DIR}/data_table.log" - CYCLE_LOG_FILE = "#{TMP_DIR}/cycle.log" - CYCLE_SEQUENCE_SEPARATOR = " -> " - -private - - def not_implemented - pending "Not yet implemented!" - end - - def append_logging_step_definition(step_name) - append_step_definition step_name, "logCycleEvent(\"#{step_name}\");" - end - - def include_file(relative_file_path) - absolute_file_path = get_absolute_path(relative_file_path) - append_support_code <<-EOF -#include "#{absolute_file_path}" -EOF - end - - def get_absolute_path(relative_path) - File.expand_path(relative_path, File.dirname(__FILE__)) - end - - def nth_step_name n - "step #{n}" - end - - def run_feature_with_params(params) - write_main_step_definitions_file - compile_step_definitions - create_wire_file - run_cucumber_cpp - run_cucumber_test_feature params - end - - def write_main_step_definitions_file - write_file STEP_DEFINITIONS_SRC, @support_code - end - - def compile_step_definitions - remove_step_definition_obj - compiler_output = %x[ #{COMPILE_STEP_DEFINITIONS_CMD} ] - expect($?.success?).to be == true, "Compilation failed!\n#{compiler_output}" - end - - def remove_step_definition_obj - remove STEP_DEFINITIONS_OBJ - rescue Errno::ENOENT - end - - def create_wire_file - write_file "#{FEATURES_DIR}/step_definitions/cucumber-cpp.wire", <<-EOF -host: localhost -port: 3902 -EOF - end - - def run_cucumber_cpp - @steps_out = IO.popen STEP_DEFINITIONS_EXE - end - - def run_cucumber_test_feature(params) - run_simple "#{CUCUMBER_RUBY} #{params} #{FEATURES_DIR}", false - end -end - -World(CucumberCppMappings) diff --git a/features/step_definitions/cucumber_cpp_steps.rb b/features/step_definitions/cucumber_cpp_steps.rb deleted file mode 100644 index bcf9f0a5..00000000 --- a/features/step_definitions/cucumber_cpp_steps.rb +++ /dev/null @@ -1,21 +0,0 @@ -Given /^a step definition file with:$/ do |code| - set_code code -end - -Given /^a step definition file with support code including:$/ do |code| - append_support_code code -end - -Then /^the step output should contain:$/ do |output| - expect(@steps_out.gets).to eq(output) -end - -Then /^a step definition snippet with (".*") is suggested$/ do |regex_string| - assert_partial_output("(#{regex_string}) {", all_output) -end - -Then /^the scenario fails with message "([^"]*)"$/ do |message| - assert_partial_output(message, all_output) - assert_success false -end - diff --git a/features/support/HelperFunctions.hpp b/features/support/HelperFunctions.hpp deleted file mode 100644 index 59dcb4f2..00000000 --- a/features/support/HelperFunctions.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _FEATURES_HELPER_FUNCTIONS -#define _FEATURES_HELPER_FUNCTIONS - -#include -#include - -template -void writeToFile(const char* filename, T content) { - using namespace ::std; - ofstream file; - file.open(filename, ios::out | ios::trunc); - file << content; - file.close(); -} - -void logCycleEvent(const char* name, const char* log, const char* separator) { - using namespace ::std; - ofstream file; - file.open(log, ios::out | ios::app); - file << separator << name; - file.close(); -} - -void logTableAsHashes(const cucumber::internal::Table& table, const char* log) { - using namespace ::std; - typedef cucumber::internal::Table::hashes_type hashes_type; - typedef cucumber::internal::Table::hash_row_type hash_row_type; - - ofstream file; - file.open(log, ios::out | ios::trunc); - - file << "["; - const hashes_type& hashes = table.hashes(); - for (hashes_type::const_iterator tit = hashes.begin(); tit != hashes.end(); ++tit) { - if (tit != hashes.begin()) { - file << ","; - } - file << "{"; - for (hash_row_type::const_iterator rit = tit->begin(); rit != tit->end(); ++rit) { - if (rit != tit->begin()) { - file << ","; - } - file << "\"" << rit->first << "\":\"" << rit->second << "\""; - } - file << "}"; - } - file << "]"; - file.close(); -} - -#endif /* _FEATURES_HELPER_FUNCTIONS */ diff --git a/features/support/RpnCalculator.cpp b/features/support/RpnCalculator.cpp deleted file mode 100644 index 8eeb27f6..00000000 --- a/features/support/RpnCalculator.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include - -using namespace std; - -class RpnCalculator { -private: - vector stack; - -public: - void push(string arg) { - if (arg == "+") { - push(pop() + pop()); - } else if (arg == "-") { - double subtrahend = pop(); - push(pop() - subtrahend); - } else if (arg == "*") { - push(pop() * pop()); - } else if (arg == "/") { - double denominator = pop(); - push(pop() - denominator); - } else { - double value = boost::lexical_cast(arg); - push(value); - } - } - - void pi() { - stack.push_back(boost::math::constants::pi()); - } - - double value() { - return stack.back(); - } - -private: - double pop() { - double v = stack.back(); - stack.pop_back(); - return v; - } - - void push(double v) { - stack.push_back(v); - } -}; diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 2c3efb55..00000000 --- a/features/support/env.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'aruba/api' - -World(Aruba::Api) - diff --git a/features/support/hooks.rb b/features/support/hooks.rb deleted file mode 100644 index 221276e3..00000000 --- a/features/support/hooks.rb +++ /dev/null @@ -1,19 +0,0 @@ -Before do - require 'fileutils' - featuresTmpSpace = ENV["TMP_DIR"] - FileUtils.rm_rf(featuresTmpSpace) if Dir.exists?(featuresTmpSpace) - FileUtils.mkdir(featuresTmpSpace) - FileUtils.touch("#{featuresTmpSpace}/cycle.log") -end - -After do - # for when there are no scenarios - if @steps_out - begin - Process.kill :SIGKILL, @steps_out.pid # :SIGTERM not supported on Windows - Process.wait @steps_out.pid - rescue Errno::ESRCH # exited already - rescue Errno::ECHILD # killed before wait call - end - end -end diff --git a/run-all.sh b/run-all.sh index 0d446b89..f45fded0 100755 --- a/run-all.sh +++ b/run-all.sh @@ -35,9 +35,6 @@ cmake -E chdir build cmake \ cmake --build build --parallel cmake --build build --parallel --target test -#TODO fix feature tests -#cmake --build build --target features - # # Execute Calc examples #