TDD in C

I do frontend AngularJS work for a client in Portland. One of the things I really like about their setup is its test-friendliness. They use Grunt to watch the client-side files and run tests and re-compile everything automatically when a change is detected. Everything gets wiped from the “build” directory when the process starts, and a failing test or JSLint warning blocks the whole process. This renders the developer’s copy of the web app inaccessible until the issue is addressed. I’ve found I enjoy this particular workflow as I’m immediately made aware of when I write something that breaks the tests. It keeps me from building on top of broken foundations.

This weekend I decided I wanted to sharpen my C skills by writing a simple CLI utility to convertĀ strings of hexadecimal to memorable phrases and back again. Since my intended use case was encoding and recovering 256-bit private keys, I wanted to take extra care to ensure correctness of output. So I set out with the intention of writing both unit and user acceptance tests using a TDD flow similar to the one I use in my AngularJS work.