A small API for mutating strings.
Some of our tests started failing, upon investigating the cause we've found that some of our core functions have disappeared. We have only one hope to save our API - Test-Driven Development!
Reversemust reverse the sequence -Reverse("ABCD") == "DCBA"Countmust return the number of elements in the sequence -Count("ABCD") == 4Separatemust return the sequence with each element comma separated -Separate("ABCD") == "A,B,C,D"EncodeBase64must encode the sequence to valid Base64 string -EncodeBase64("ABCD") == "QUJDRA=="DecodeBase64must decode a Base64-encoded sequence to a regular string -DecodeBase64("QUJDRA==") == "ABCD"EncodeShiftLeftmust shift the sequence left N number of times -EncodeShiftLeft("ABCD", 2) == "CDAB"DecodeShiftLeftmust reverse the shifting of sequence left N number of times -DecodeShiftLeft("CDAB", 2) == "ABCD"EncodeShiftRightmust shift the sequence right, N number of times -EncodeShiftRight("ABCD", 3) == "CDBA"DecodeShiftRightmust reverse the shifting of sequence right N number of times -DecodeShiftRight("CDBA", 3) == "ABCD"
From the CLI, execute
git clone https://github.com/burtawicz/tdd-workshop-goto clone the repository to your machinecd tdd-workshop-goto enter the project directorygo buildto build the project
From the CLI, execute go test