Kata to practice TDD
Write a function that returns for a given number from 1 to 100 this given number, except that :
- For multiples of 3 returns “Fizz”
- For the multiples of 5 returns “Buzz”
- For numbers which are multiples of both 3 and 5 returns “FizzBuzz”
- Identify test cases
- How would you name your first test ?
- Write on a Sticky note what would be the name of your first test
- Compare the different styles
- What do you prefer / why (Dot voting)
- Remove “if” in your code
- Parameterize your FizzBuzz, implement this method :
- int limit : 100
- int fizz : 3
- int buzz : 5
- Extend your program
- Multiples of 7 are “Whizz”
- Multiples of 11 are “Bang”
- Create a Higher Order Function (fizzBuzz function takes an action function in args)
- Add a voice output
- Write it in an unknown language (still by using TDD)
- ...
What happened to your code when implementing new tests ?