Abstract
The specification of a class in Haskell often starts with stating, in comments, the laws that should be satisfied by methods defined in instances of the class, followed by the type of the methods of the class. This paper develops a framework that supports testing such class laws using QuickCheck. Our framework is a light-weight class law testing framework, which requires a limited amount of work per class law, and per datatype for which the class law is tested. We also show how to test class laws with partially-defined values. Using partially-defined values, we show that the standard lazy and strict implementations of the state monad do not satisfy the expected laws.
- J.-P. Bernardy, P. Jansson, and K. Claessen. Testing polymorphic properties. In ESOP'10, volume 6012 of Lecture Notes in Computer Science, pages 125--144. Springer, 2010. Google Scholar
Digital Library
- M. M. T. Chakravarty, G. Keller, S. Peyton Jones, and S. Marlow. Associated types with class. In POPL'05, pages 1--13. ACM, 2005. Google Scholar
Digital Library
- K. Claessen and J. Hughes. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In ICFP'00, pages 286--279. ACM, 2000. Google Scholar
Digital Library
- N. A. Danielsson and P. Jansson. Chasing bottoms: A case study in program verification in the presence of partial and infinite values. In MPC'04, volume 3125 of Lecture Notes in Computer Science, pages 85--109. Springer, 2004.Google Scholar
- N. A. Danielsson, J. Hughes, P. Jansson, and J. Gibbons. Fast and loose reasoning is morally correct. In POPL'06, pages 206--217. ACM, 2006. Google Scholar
Digital Library
- C. Elliott. Checkers. A Haskell package available on Hackage, 2012. URL http://hackage.haskell.org/package/checkers-0.2.9.Google Scholar
- J. Gibbons and R. Hinze. Just do it: simple monadic equational reasoning. In ICFP'11, pages 2--14. ACM, 2011. Google Scholar
Digital Library
- P. Jansson and J. Jeuring. Polytypic data conversion programs. Science of Computer Programming, 43 (1): 35--75, 2002. Google Scholar
Digital Library
- S. Marlow, editor. Haskell 2010 Language Report, 2010. http://www.haskell.org/onlinereport/haskell2010/.Google Scholar
- C. Runciman, M. Naylor, and F. Lindblad. Smallcheck and lazy smallcheck: automatic exhaustive testing for small values. In Haskell'08, pages 37--48. ACM, 2008. Google Scholar
Digital Library
- W. Taysom. Quickchecking type class laws. Blog post, 2011. URL http://www.cubiclemuses.com/cm/articles/2011/07/14/quickchecking-type-class-laws/.Google Scholar
Index Terms
Testing type class laws
Recommendations
Testing type class laws
Haskell '12: Proceedings of the 2012 Haskell SymposiumThe specification of a class in Haskell often starts with stating, in comments, the laws that should be satisfied by methods defined in instances of the class, followed by the type of the methods of the class. This paper develops a framework that ...
Weak Mutation Testing and Completeness of Test Sets
Different approaches to the generation of test data are described. Error-based approaches depend on the definition of classes of commonly occurring program errors. They generate tests which are specifically designed to determine if particular classes of ...
Incremental Class Testing from a Class Test Order
COMPSAC '05: Proceedings of the 29th Annual International Computer Software and Applications Conference - Volume 01Many approaches exist to decide the order in which classes should be integrated during (integration) testing. Most of them, based on an analysis of class dependencies (for instance described in a UML class diagram) aim at producing a partial order ...







Comments