This is a step-by-step guide for writing FizzBuzz with TDD in GO. You can see every step in each commit.
The whole concept is simple.
- When input any number, it should return that number.
- When input number that can divide by 3, it should return
Fizz
. - When input number that can divide by 5, it should return
Buzz
. - When input number that can divide by 3 and 5, it should return
FizzBuzz
.
Input | Output |
---|---|
1 | 1 |
2 | 2 |
3 | Fizz |
4 | 4 |
5 | Buzz |
6 | Fizz |
7 | 7 |
8 | 8 |
9 | Fizz |
10 | Buzz |
11 | 11 |
12 | Fizz |
13 | 13 |
14 | 14 |
15 | FizzBuzz |
... | ... |