Move tests to separate directory
Fix a bug in data pattern unification
Fix pretty-printing and make optimisation toggleable