a story about my journey in the land of programming practices

Post on 15-Jul-2015

192 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Given (/^I have entered (\d+) into the calculator$/)do |n| calculator - Calculator.new calculator.push(n.to_i)end

class Calculator def push(n) @args ||= [] @args << n endend

Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers

Scenario: Add two numbers Given I have entered 23 into the calculator And I have entered 41 into the calculator When I press add Then the result should be 64 on the screen

Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers

Scenario: Add two numbers Given I have entered 23 into the calculator And I have entered 41 into the calculator When I press add Then the result should be 64 on the screen

using cucumber::ScenarioScope;

struct CalcCtx { Calculator calc; double result;};

GIVEN("^I have entered (\\d+) into the calculator$") { REGEX_PARAM(double, n); ScenarioScope<CalcCtx> context;

context->calc.push(n);}

class Calculator { public: void push(int n) { stack.push_back(n); }

private: std::vector<int> stack;};

https://github.com/

https://travis-ci.org/

https://coveralls.io/

https://godoc.org/

Test Driven Development: By ExampleKent Beck

Growing object-oriented software guided by testsSteve Freeman, Nat Pryce

Modern C++ Programming with Test-Driven Development: Code Better, Sleep BetterJeff Langr

The Pragmatic Programmer: From Journeyman to MasterAndrew Hunt, David Thomas

Becoming a Better Programmer: A Handbook for People Who Care About CodePete Goodliffe

top related