by @niklas_heer
There is always more to be found by exploring the same subject again and again.
-Dion Archibald
.
- Michael Feathers
The following is a TDD Kata- an exercise in coding, refactoring and test-first.
1. Create a simple String calculator with a method
int Add(string numbers) :
2. Allow the add method to handle an unknown amount of numbers
3. Allow the add method to handle new lines between numbers (instead of commas):
4. Support different delimiters
5. Calling add with a negative number will throw an exception “negatives not allowed” - and the negative that was passed. If there are multiple negatives, show all of them in the exception message
6. Numbers bigger than 1000 should be ignored, so adding 2 + 1001 = 2
7. Delimiters can be of any length with the following format: “//[delimiter]\n” for example: “//[***]\n1***2***3” should return 6
8. Allow multiple delimiters like this: “//[delim1][delim2]\n” for example “//[*][%]\n1*2%3” should return 6.
9. Make sure you can also handle multiple delimiters with length longer than one char