Closed mariopavlovic closed 8 years ago
Just realized that maybe you want to check for empty strings? As this is something that would be part of the "fuller test suit"?
Yes, we absolutely do want to check for empty strings. There are many cases in which this could break the property under test.
We used to implement
Smaller
protocol onString
so that it returns a new string, without a first character, for all non-empty strings. This would reduce all strings to an empty string when runningsmaller
function repeatedly. New implementation defines smallestString
as a single character string, which prevents the occurrence of the empty string as a result ofsmaller
function.Example: Before running
smaller
repeatedly on "Hello" string would output "ello", "llo", "lo", "o", "". Now runningsmaller
repeatedly on "Hello" string would output "ello", "llo", "lo", "o".Note: This PR is just a suggestion, as it's a small change and it would require update of the book feel free to backlog it or reject