nette/tester environment
1: Create a simple String calculator with a method int Add(string numbers)
green
1 a: The method can take 0, 1, or 2 numbers and will return their sum.
1 b: An empty string will return 0.
green
1 c: Example inputs: “”, “1”, or “1,2”
1 d: Start with the simplest test case of an empty string. Then 1 number...
green
...Then 2 numbers.
green
2: Allow the Add method to handle an unknown number of arguments/numbers.
green
3: Allow the Add method to handle new lines between numbers (instead of commas).
green
4: Allow the Add method to handle a different delimiter:
4 a: To change the delimiter, the beginning of the string will contain a separate line that looks like this: “//[delimiter]\n[numbers]”
green
refactoring
5: Calling Add with a negative number will throw an exception “Negatives not allowed: “ listing all negative numbers that were in the list of numbers.
5 a: Example “-1,2” throws “Negatives not allowed: -1”
green
5 b: Example “2,-4,3,-5” throws “Negatives not allowed: -4,-5”
green