Toxaris / pts

Interpreter for functional pure type systems.
BSD 3-Clause "New" or "Revised" License
21 stars 7 forks source link

Test parser-printer roundtrips with quickcheck #42

Open Toxaris opened 11 years ago

Toxaris commented 11 years ago

@Blaisorblade proposes in https://github.com/Toxaris/pts/issues/33#issuecomment-14663123:

Can somebody please add a couple of tests to our pretty-printer?

We can check that parser and pretty printer are in sync by testing the round trip property via test case generation. An easy to check property would be something like:

 \x -> print (parse (print x)) == print x

But it would be better to check equivalence of ASTs some other way then printing both, maybe by adding a identicalTerm function`? Then we could have the following property:

\x -> parse (print x) `identicalTerm` x