1. |
- Almström Duregård, Jonas, 1984, et al.
(författare)
-
Feat: Functional Enumeration of Algebraic Types
- 2012
-
Ingår i: 2012 ACM SIGPLAN Haskell Symposium, Haskell 2012. Copenhagen, 13 September 2012. - New York, NY, USA : ACM. - 9781450315746 ; , s. 61-72
-
Konferensbidrag (refereegranskat)abstract
- In mathematics, an enumeration of a set S is a bijective function from (an initial segment of) the natural numbers to S. We define "functional enumerations" as efficiently computable such bijections. This paper describes a theory of functional enumeration and provides an algebra of enumerations closed under sums, products, guarded recursion and bijections. We partition each enumerated set into numbered, finite subsets.We provide a generic enumeration such that the number of each part corresponds to the size of its values (measured in the number of constructors). We implement our ideas in a Haskell library called testing-feat, and make the source code freely available. Feat provides efficient "random access" to enumerated values. The primary application is property-based testing, where it is used to define both random sampling (for example QuickCheck generators) and exhaustive enumeration (in the style of SmallCheck). We claim that functional enumeration is the best option for automatically generating test cases from large groups of mutually recursive syntax tree types. As a case study we use Feat to test the pretty-printer of the Template Haskell library (uncovering several bugs).
|
|
2. |
- Lindström Claessen, Koen, 1975
(författare)
-
Shrinking and showing functions (Functional pearl)
- 2012
-
Ingår i: SIGPLAN Notices (ACM Special Interest Group on Programming Languages). - : Association for Computing Machinery (ACM). - 0730-8566 .- 0362-1340 .- 1558-1160. - 9781450315746 ; 47:12, s. 73-80
-
Konferensbidrag (refereegranskat)abstract
- Although quantification over functions in QuickCheck properties has been supported from the beginning, displaying and shrinking them as counter examples has not. The reason is that in general, functions are infinite objects, which means that there is no sensible show function for them, and shrinking an infinite object within a finite number of steps seems impossible. This paper presents a general technique with which functions as counter examples can be shrunk to finite objects, which can then be displayed to the user. The approach turns out to be practically usable, which is shown by a number of examples. The two main limitations are that higher-order functions cannot be dealt with, and it is hard to deal with terms that contain functions as subterms.
|
|