Skip to main content

Generating Constrained Random Data with Uniform Distribution

  • Conference paper
Functional and Logic Programming (FLOPS 2014)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8475))

Included in the following conference series:

Abstract

We present a technique for automatically deriving test data generators from a predicate expressed as a Boolean function. The distribution of these generators is uniform over values of a given size. To make the generation efficient we rely on laziness of the predicate, allowing us to prune the space of values quickly. In contrast, implementing test data generators by hand is labour intensive and error prone. Moreover, handwritten generators often have an unpredictable distribution of values, risking that some values are arbitrarily underrepresented. We also present a variation of the technique where the distribution is skewed in a limited and predictable way, potentially increasing the performance. Experimental evaluation of the techniques shows that the uniform derived generators are much easier to define than hand-written ones, and their performance, while lower, is adequate for some realistic applications.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Arts, T., et al.: Testing Telecoms Software with Quviq QuickCheck. In: Proc. 2006 Erlang Workshop, pp. 2–10. ACM (2006)

    Google Scholar 

  2. Boyapati, C., Khurshid, S., Marinov, D.: Korat: Automated Testing Based on Java Predicates. In: Proc. 2002 Inl. Symp. Software Testing and Analysis (ISSTA 2002), pp. 123–133. ACM (2002)

    Google Scholar 

  3. Christiansen, J., Fischer, S.: EasyCheck: test data for free. In: Garrigue, J., Hermenegildo, M.V. (eds.) FLOPS 2008. LNCS, vol. 4989, pp. 322–336. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  4. Claessen, K., Hughes, J.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: ICFP 2000, pp. 268–279. ACM (2000)

    Google Scholar 

  5. Duregard, J., Jansson, P., Wang, M.: FEAT: functional enumeration of algebraic types. In: Proc. 2012 Symp. Haskell, pp. 61–72. ACM (2012)

    Google Scholar 

  6. Feldt, R., Poulding, S.: Finding Test Data with Specific Properties viaMetaheuristic Search. In: Proc. Intl. Symp. Software Reliability Engineering (ISSRE). IEEE (2013)

    Google Scholar 

  7. Fischer, S., Kiselyov, O., Shan, C.C.: Purely functional lazy nondeterministic programming. J. Funct. Program. 21(4-5), 413–465 (2011)

    Article  MATH  MathSciNet  Google Scholar 

  8. Grygiel, K., Lescanne, P.: Counting and generating lambda terms. J. Funct. Program. 23, 594–628 (2013)

    Article  MATH  MathSciNet  Google Scholar 

  9. Palka, M.H.: Testing an Optimising Compiler by Generating Random Lambda Terms. Licentiate Thesis. Chalmers University of Technology, Gothenburg, Sweden (2012)

    Google Scholar 

  10. Runciman, C., Naylor, M., Lindblad, F.: Smallcheck and lazy smallcheck: automatic exhaustive testing for small values. In: Haskell 2008, pp. 37–48. ACM (2008)

    Google Scholar 

  11. Rodriguez Yakushev, A., Jeuring, J.: Enumerating Well-Typed Terms Generically. In: Schmid, U., Kitzelmann, E., Plasmeijer, R. (eds.) AAIP 2009. LNCS, vol. 5812, pp. 93–116. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this paper

Cite this paper

Claessen, K., Duregård, J., Pałka, M.H. (2014). Generating Constrained Random Data with Uniform Distribution. In: Codish, M., Sumii, E. (eds) Functional and Logic Programming. FLOPS 2014. Lecture Notes in Computer Science, vol 8475. Springer, Cham. https://doi.org/10.1007/978-3-319-07151-0_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-07151-0_2

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-07150-3

  • Online ISBN: 978-3-319-07151-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics