Testing Polymorphic Properties

This paper is concerned with testing properties of polymorphic functions. The problem is that testing can only be performed on specific monomorphic instances, whereas parametrically polymorphic functions are expected to work for any type. We present a schema for constructing a monomorphic instance for a polymorphic property, such that correctness of that single instance implies correctness for all other instances. We also give a formal definition of the class of polymorphic properties the schema can be used for. Compared to the standard method of testing such properties, our schema leads to a significant reduction of necessary test cases.

[1]  Brian A. Davey,et al.  An Introduction to Lattices and Order , 1989 .

[2]  David Thomas,et al.  The Art in Computer Programming , 2001 .

[3]  Nils Anders Danielsson,et al.  Fast and loose reasoning is morally correct , 2006, POPL '06.

[4]  Tim Sheard,et al.  Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space) , 1996, POPL '96.

[5]  Erik Poll,et al.  Algebra of Programming by Richard Bird and Oege de Moor, Prentice Hall, 1996 (dated 1997). , 1999 .

[6]  Tim Sheard,et al.  Revisiting catamorphisms over datatypes with embedded functions , 1995 .

[7]  Sebastian Fischer,et al.  EasyCheck - Test Data for Free , 2008, FLOPS.

[8]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[9]  John Hughes,et al.  Testing telecoms software with quviq QuickCheck , 2006, ERLANG '06.

[10]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[11]  Daniel Hoffman,et al.  Testing generic Ada packages with APE , 1998 .

[12]  Joyce L. Vedral,et al.  Functional Programming Languages and Computer Architecture , 1989, Lecture Notes in Computer Science.

[13]  Patricia Johann,et al.  Free theorems in the presence of seq , 2004, POPL.

[14]  Donald E. Knuth,et al.  The art of computer programming, volume 3: (2nd ed.) sorting and searching , 1998 .

[15]  Corrado Böhm,et al.  Automatic Synthesis of Typed Lambda-Programs on Term Algebras , 1985, Theor. Comput. Sci..

[16]  Stephanie Weirich,et al.  Boxes go bananas: encoding higher-order abstract syntax with parametric polymorphism , 2003, ICFP '03.

[17]  David F. Bacon,et al.  Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companion , 2007, OOPSLA 2007.

[18]  Janis Voigtländer Much ado about two (pearl): a pearl on parallel prefix computation , 2008, POPL '08.

[19]  Mary Sheeran Hardware Design and Functional Programming: a Perfect Match , 2005, J. Univers. Comput. Sci..

[20]  Thorsten Altenkirch,et al.  Foundations of Software Science and Computation Structures: 6th International Conference, FOSSACS 2003 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2003 Warsaw, Poland, April 7–11, 2003 Proceedings , 2003, Lecture Notes in Computer Science.

[21]  Magne Haveraaen,et al.  Axiom-based testing for C++ , 2008, OOPSLA Companion.

[22]  Maarten M. Fokkinga Datatype Laws without Signatures , 1996, Math. Struct. Comput. Sci..

[23]  Ralf Hinze Church numerals, twice! , 2005, J. Funct. Program..

[24]  Johan Jeuring,et al.  Testing Properties of Generic Functions , 2006, IFL.

[25]  Simon L. Peyton Jones,et al.  A short cut to deforestation , 1993, FPCA '93.

[26]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.

[27]  Colin Runciman,et al.  Smallcheck and lazy smallcheck: automatic exhaustive testing for small values , 2008, Haskell '08.

[28]  Koen Claessen,et al.  QuickCheck: a lightweight tool for random testing of Haskell programs , 2011, SIGP.

[29]  François Pottier,et al.  Polymorphic typed defunctionalization and concretization , 2006, High. Order Symb. Comput..

[30]  Olivier Danvy,et al.  Defunctionalization at work , 2001, PPDP '01.

[31]  Josef Svenningsson Shortcut fusion for accumulating parameters & zip-like functions , 2002, ICFP '02.

[32]  Chandra Krintz,et al.  SIGPLAN programming language curriculum workshop: Workshop report summary , 2008, SIGP.

[33]  Nikolai Tillmann,et al.  Parameterized unit tests , 2005, ESEC/FSE-13.

[34]  David Saff Theory-infected: or how i learned to stop worrying and love universal quantification , 2007, OOPSLA '07.

[35]  Ian Stark,et al.  Free-Algebra Models for the pi-Calculus , 2005, FoSSaCS.