[mercury-users] Compiler test-case generation, Re: Meta programming

doug.auclair at logicaltypes.com doug.auclair at logicaltypes.com
Thu Feb 2 07:43:29 AEDT 2006


Dear Ian, you wrote:

>Another option is to add a compiler option that causes the compiler 
>to produce random test cases for the code it compiles (since the 
>compiler has access to all the necessary info).

Brilliant!  I could then add a '--quickcheck-exported-predicates' flag that would then generate the test cases as a new module and then execute that module's main/2 when the system compiles successfully.  There are a couple of consequences that I need to work through, however:

1. a new version release will destroy the changes I've made to the compiler (as I have discover on the rapid turnaround of releases 0.12.1 to 0.12.2 for my op/3 addition);
2. automatic test case generation is more of an assistant to the test writer: writing a comprehesive test case generation tool costs too much verses the payoff of providing base cases to assist the test writer complete the system.  So, the compile cycle needs to include a phase for user intervention to guide the compiler to writing appropriate test cases (quickcheck requires this).  This devolves into a chicken-or-egg problem, as either a domain specific language must be provided (yuck!) to associate specific tests to specific clauses a priori or an interactive (yuck!) environment (like the very nice declarative debugger) must be set up to allow the user to shepherd the compilation/testing process.

I suppose the best way to go about 2., after reflection, is to have '--quickcheck-exported-predicates' halt after it generates the module(s) of test cases so that the user may fill out the tests cases and then recompile with the test module's main at the top.

Thoughts? Counterproposals?

Sincerely,
Doug Auclair

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list