Testing Haskell with Quickcheck
After my last post about working with HUnit for doing unit testing in Haskell, dons suggested that I look at QuickCheck as an alternative that enables higher level testing.
QuickCheck is an easy to use framework that requires you to write a specification of your code by defining invariant properties. It then generates random, sample data to verify that the properties hold. This higher level view of testing is a good match with Haskell, since the functional nature makes unit testing far less important than with other languages.
Unit Testing with HUnit in Haskell
If you’re familiar with JUnit and Test::Unit then HUnit is the Haskell equivalent for unit testing. As I started to work with it I found it syntactically different than the others, which was something I expected since Haskell is such a different language than Java or Ruby. But what I hadn’t expected, was that it might be lacking in some way compared to the others.
Haskell, being a functional programming language, dispenses with the need for declaring a top level class that inherits from the framework and writing test methods that start with “test” in their name.
Summing a Column of Numbers in Emacs
Emacs continues to amaze me every single day. It’s getting near tax time and today I was summarizing various expenses in an ascii file. Why ascii and not Excel or some other spreadsheet? Well, for one they are overkill when all you want is a simple column of numbers and a sum. Secondly, my summary as an ascii file will be viewable ten years from now without me having to get the latest version of MS Office or whatever and worrying about data migration.
Rubygem Dependencies
The other day, a friend of mine told me about some rubygem problems she was having. Her company’s firewall was a bit flaky and rubygems wasn’t able to auto grab dependencies for her. What she wanted was a way to determine a gem’s dependencies without yet installing it.
The gem dependency command is supposed to have an option to let you see the dependencies on a gem – but it only works on already installed gems.