Written in 2004 by Eric Anholt.
Additional tests contributed by Lars Knoll.
