Testing Properties of Generic Functions

  • Patrik Jansson
  • Johan Jeuring
  • Laurence Cabenda
  • Gerbo Engels
  • Jacob Kleerekoper
  • Sander Mak
  • Michiel Overeem
  • Kees Visser
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4449)

Abstract

A datatype-generic function is a family of functions indexed by (the structure of) a type. Examples include equality tests, maps and pretty printers. Property based testing tools like QuickCheck and Gast support the definition of properties and test-data generators, and they check if a monomorphic property is satisfied by the test cases. Generic functions satisfy generic properties and this paper discusses specifying and testing such properties. It shows how generic properties and generators can be expressed, and explains three bugs we found and corrected in the Generic Haskell library.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Beck, K.: Test-Driven Development by Example. Addison-Wesley, Reading (2003)Google Scholar
  2. 2.
    Claessen, K., Hughes, J.: QuickCheck: A lightweight tool for random testing of Haskell programs. In: ICFP 2000, pp. 268–279. ACM Press, New York (2000)CrossRefGoogle Scholar
  3. 3.
    Hinze, R.: Generic Programs and Proofs. Bonn University, Habilitation (2000)Google Scholar
  4. 4.
    Hinze, R., Jeuring, J.: Generic Haskell: practice and theory. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 1–56. Springer, Heidelberg (2003)Google Scholar
  5. 5.
    Hinze, R., Jeuring, J., Löh, A.: Comparing approaches to generic programming in Haskell. Technical Report UU-CS-2006-022, ICS, Utrecht University, 2006. In: Datatype-Generic Programming, LNCS, Springer (to appear, 2007)Google Scholar
  6. 6.
    Holdermans, S., Jeuring, J., Löh, A., Rodriguez, A.: Generic views on data types. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, Springer, Heidelberg (2006)CrossRefGoogle Scholar
  7. 7.
    Jansson, P., Jeuring, J.: PolyLib – a polytypic function library. In: Workshop on Generic Programming, Marstrand (June 1998)Google Scholar
  8. 8.
    Koopman, P., Alimarine, A., Tretmans, J., Plasmeijer, R.: Gast: Generic automated software testing. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 84–100. Springer, Heidelberg (2002)Google Scholar
  9. 9.
    Koopman, P., Plasmeijer, R.: Generic generation of elements of types. In: TFP’05, pp. 167–179. Tallinn (2005)Google Scholar
  10. 10.
    Löh, A.: Exploring Generic Haskell. PhD thesis, Utrecht University (2004)Google Scholar
  11. 11.
    Löh, A., Clarke, D., Jeuring, J.: Dependency-style Generic Haskell. In: Shivers, O. (ed.) ICFP 2003, pp. 141–152. ACM Press, New York (2003)CrossRefGoogle Scholar
  12. 12.
    Löh, A., Jeuring, J., Rodriguez, A.: (editors) et al. The Generic Haskell user’s guide, Version 1.60 - Diamond release. Technical Report UU-CS-2006-049, ICS, Utrecht University (2006)Google Scholar
  13. 13.
    Mitchelland, R., McKim, J.: Design by Contract: by example. Addison-Wesley, Reading (2002)Google Scholar
  14. 14.
    Peyton Jones, S., et al.: Haskell 98, Language and Libraries. In: The Revised Report, Cambridge University Press, Cambridge (2003)Google Scholar
  15. 15.
    Plasmeijer, R., van Eekelen, M.: Clean Language Report version 2.1 (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Patrik Jansson
    • 1
  • Johan Jeuring
    • 2
  • Laurence Cabenda
    • 1
  • Gerbo Engels
    • 3
  • Jacob Kleerekoper
    • 3
  • Sander Mak
    • 3
  • Michiel Overeem
    • 3
  • Kees Visser
    • 3
  1. 1.CSE, Chalmers University of TechnologySweden
  2. 2.ICS, Utrecht UniversityThe Netherlands
  3. 3.Students of the Utrecht University Generic Programming class 

Personalised recommendations