Today we were training TDD and found the following point of misunderstanding.
The task is for the input "1,2" return sum of numbers which is 3. What I have written (in C#) was:
numbers = input.Split(','); return int.Parse(numbers) + int.Parse(numbers); //task said we have two numbers and input is correct
But other guys preferred to do it other way. First, for input "1,2" they made added the following code:
if (input == "1,2") return 3;
Then they introduced one more test for input "4,5" and changed implementation:
if (input == "1,2") return 3; else if (input == "4,5") return 9;
And after that they said "Okay, now we see the pattern" and implemented what I initially did.
I think the second approach better fits the TDD definition but... should we be so strict about it? For me it is okay to skip trivial baby steps and combine them into "twinsteps" if I am sure enough that I won't skip anything. Am I wrong?
Update. I have made a mistake by not clarifing it was not the first test. There already were some tests so "return 3" actually wasn't the simplest piece of code to satisfy the requirement.