emilybache/Phone-Numbers-Kata — pull request #1 by fffej (2013-08-09 12:01:51+00:00)
Title: Using Haskell to generate infinite amounts of test data

One of the things I'm really interested in is QuickCheck (http://en.wikipedia.org/wiki/QuickCheck). This is the idea that you express tests as assertions of invariants (rather than spot checking some data).

One of the really neat things you can do with this is model-based testing. In this example I've specified what a consistent phone book looks like. Instead of needing to manually create test data (or scrape from sources), I can ask Haskell to generate some test data for which a particular invariant holds.

I really like this approach for tests, as it allows me to write a really naive implementation and get the acceptance test for that sorted, before drilling into a more proper implementation (I imagine for this Phone Numbers exercise, I'd need to use prefix trees or something else cleverer than a brute force search).

I just thought I'd throw this pull request in as it's something I find interesting!