C++ Project Outline
Developer Studio 2008 Project Directories: cpptdd.zip
Projects
- Rpn Calculator
- Legacy Refactoring
- Replacing Switch with Polymorphism
- Open Project
Rpn Calculator
This project introduces the mechanics of TDD in C++. Along the way, you will:
- Create several unit tests
- Refactor your code
- Refactor to design patterns
- Strategy Pattern
- Template Method Pattern
- Abstract factory pattern
- Use test doubles to test pure-virtual class
Behaviors
Round 1
- XRegister should be 0 after creation
Round 2
- Digits pressed should be in X Register
- XRegister should not change after pressing enter
- XRegister should be copied on stack
- XRegister should be reset on first digit after enter
- XRegsiter should not be reset on second digit after enter
Round 3
- Adding 2 numbers correctly
- Adding 0 numbers OK
Refactor Stack
Minus, Factorial
Change calculator API
Move to Strategy Pattern
Create Template Method using Test Doubles
Legacy Refactoring/Characterization Testing
Given a wad of code, write characterization tests for it. Once you’ve characterized it, use the tests to safely refactor the code.
Replacing Switch with Polymorphism
Take the previous example through one more refactoring.
Logging In Example
Work on a project on your own with guidance.
Comments