TreeEntry: add rich comparison function

Allow direct comparisons between TreeEntry objects, which also allows us
to use assertEqual in the sanity check test.

This fixes #305.
Merge remote-tracking branch 'carlos/treeentry-cmp'