Skip to main content

PrologCheck – Property-Based Testing in Prolog

  • Conference paper
Book cover 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 PrologCheck, an automatic tool for property based testing of programs in the logic programming language Prolog with randomised test data generation. The tool is inspired by the well known QuickCheck, originally designed for the functional programming language Haskell. It includes features that deal with specific characteristics of Prolog such as its relational nature (as opposed to Haskell) and the absence of a strong type discipline.

PrologCheck expressiveness stems from describing properties as Prolog goals. It enables the definition of custom test data generators for random testing tailored for the property to be tested. Further, it allows the use of a predicate specification language that supports types, modes and constraints on the number of successful computations. We evaluate our tool on a number of examples and apply it successfully to debug a Prolog library for AVL search trees.

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.

References

  1. Antoy, S., Hanus, M.: Overlapping rules and logic variables in functional logic programs. In: Etalle, S., Truszczyński, M. (eds.) ICLP 2006. LNCS, vol. 4079, pp. 87–101. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  2. Bernardy, J.-P., Jansson, P., Claessen, K.: Testing polymorphic properties. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 125–144. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  3. Boberg, J.: Early fault detection with model-based testing. In: Proc. of Workshop on Erlang, pp. 9–20. ACM (2008)

    Google Scholar 

  4. 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 

  5. Claessen, K., Hughes, J.: Quickcheck: a lightweight tool for random testing of haskell programs. In: Proc. of ICFP, pp. 268–279. ACM (2000)

    Google Scholar 

  6. Claessen, K., Hughes, J., Pałka, M., Smallbone, N., Svensson, H.: Ranking programs using black box testing. In: Proc. of AST, pp. 103–110. ACM (2010)

    Google Scholar 

  7. Claessen, K., Pałka, M., Smallbone, N., Hughes, J., Svensson, H., Arts, T., Wiger, U.: Finding race conditions in erlang with quickcheck and pulse. In: Proc. of ICFP, pp. 149–160. ACM (2009)

    Google Scholar 

  8. Costa, V.S., Rocha, R., Damas, L.: The yap prolog system. TPLP 12(1-2), 5–34 (2012)

    MATH  MathSciNet  Google Scholar 

  9. Deville, Y.: Logic programming: systematic program development. Addison-Wesley Longman Publishing Co. Inc., Boston (1990)

    Google Scholar 

  10. Duregård, J., Jansson, P., Wang, M.: Feat: functional enumeration of algebraic types. In: Proc. of Haskell Symposium, pp. 61–72. ACM (2012)

    Google Scholar 

  11. Florido, M., Damas, L.: Types as theories. In: Proc. of post-conference workshop on Proofs and Types, JICSLP (1992)

    Google Scholar 

  12. Frühwirth, T.W., Shapiro, E.Y., Vardi, M.Y., Yardeni, E.: Logic programs as types for logic programs. In: Proc. of LICS, pp. 300–309 (1991)

    Google Scholar 

  13. Hermenegildo, M.V., Bueno, F., Carro, M., López-García, P., Mera, E., Morales, J.F., Puebla, G.: An overview of ciao and its design philosophy. In: TPLP, pp. 219–252 (2012)

    Google Scholar 

  14. Koopman, P., Alimarine, A., Tretmans, J., Plasmeijer, R.: Gast: Generic automated software testing. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 84–100. Springer, Heidelberg (2003)

    Google Scholar 

  15. Mera, E., Lopez-García, P., Hermenegildo, M.: Integrating software testing and run-time checking in an assertion verification framework. In: Hill, P.M., Warren, D.S. (eds.) ICLP 2009. LNCS, vol. 5649, pp. 281–295. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  16. Naylor, M.: A logic programming library for test-data generation (2007)

    Google Scholar 

  17. Papadakis, M., Sagonas, K.: A proper integration of types and function specifications with property-based testing. In: Proc. of Workshop on Erlang, pp. 39–50. ACM (2011)

    Google Scholar 

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

    Google Scholar 

  19. Somogyi, Z., Henderson, F.J., Conway, T.C.: Mercury, an efficient purely declarative logic programming language. Australian Computer Science Communications 17, 499–512 (1995)

    Google Scholar 

  20. Wielemaker, J., Schrijvers, T., Triska, M., Lager, T.: Swi-prolog. TPLP 12(1-2), 67–96 (2012)

    MATH  MathSciNet  Google Scholar 

  21. Yardeni, E., Shapiro, E.: A type system for logic program. J. Log. Program. 10(2), 125–153 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  22. Zobel, J.: Derivation of polymorphic types for prolog programs. In: Proc. of ICLP, pp. 817–838 (1987)

    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

Amaral, C., Florido, M., Santos Costa, V. (2014). PrologCheck – Property-Based Testing in Prolog. 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_1

Download citation

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

  • 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