All Projects → Wilfred → Propcheck

Wilfred / Propcheck

Quickcheck/hypothesis style testing for elisp

Projects that are alternatives of or similar to Propcheck

efftester
Effect-Driven Compiler Tester for OCaml
Stars: ✭ 37 (-27.45%)
Mutual labels:  quickcheck
Jqwik
Property-Based Testing on the JUnit Platform
Stars: ✭ 265 (+419.61%)
Mutual labels:  quickcheck
Junit Quickcheck
Property-based testing, JUnit-style
Stars: ✭ 821 (+1509.8%)
Mutual labels:  quickcheck
hypothesis sqlalchemy
hypothesis strategies for generating SQLAlchemy objects
Stars: ✭ 24 (-52.94%)
Mutual labels:  quickcheck
lplzoo
Fine-grain implementations of common lambda calculi in Haskell, tested with QuickCheck
Stars: ✭ 32 (-37.25%)
Mutual labels:  quickcheck
Quicktheories
Property based testing for Java 8
Stars: ✭ 483 (+847.06%)
Mutual labels:  quickcheck
fuzz-rest-api
Derive property based testing fast-check into a fuzzer for REST APIs
Stars: ✭ 38 (-25.49%)
Mutual labels:  quickcheck
Quick check.js
A JS implementation of quick_check
Stars: ✭ 48 (-5.88%)
Mutual labels:  quickcheck
ke-e
假的 (ké--ê) is a property-based testing library, inspired by QuickCheck, Hypothesis, JSVerify and faker.js.
Stars: ✭ 25 (-50.98%)
Mutual labels:  quickcheck
Stream data
Data generation and property-based testing for Elixir. 🔮
Stars: ✭ 597 (+1070.59%)
Mutual labels:  quickcheck
pbt-frameworks
An overview of property-based testing functionality
Stars: ✭ 29 (-43.14%)
Mutual labels:  quickcheck
haskell-schema
A library for describing Haskell data types and obtain free generators, JSON codecs, pretty printers, etc.
Stars: ✭ 16 (-68.63%)
Mutual labels:  quickcheck
Tasty
Modern and extensible testing framework for Haskell
Stars: ✭ 499 (+878.43%)
Mutual labels:  quickcheck
kitimat
A library for generative, property-based testing in TypeScript and Jest.
Stars: ✭ 68 (+33.33%)
Mutual labels:  quickcheck
Fscheck
Random Testing for .NET
Stars: ✭ 855 (+1576.47%)
Mutual labels:  quickcheck
ava-fast-check
Property based testing for AVA based on fast-check
Stars: ✭ 44 (-13.73%)
Mutual labels:  quickcheck
Jqf
JQF + Zest: Coverage-guided semantic fuzzing for Java.
Stars: ✭ 340 (+566.67%)
Mutual labels:  quickcheck
Qcstm
A simple state-machine framework for OCaml based on QCheck
Stars: ✭ 50 (-1.96%)
Mutual labels:  quickcheck
Check It
Randomized specification-based testing for Common Lisp. Available through Quicklisp.
Stars: ✭ 41 (-19.61%)
Mutual labels:  quickcheck
Haskell Hedgehog
Release with confidence, state-of-the-art property testing for Haskell.
Stars: ✭ 584 (+1045.1%)
Mutual labels:  quickcheck

propcheck Coverage Status

propcheck brings property based testing to elisp.

It's similar to the excellent Hypothesis library for Python.

Status: beta. It works, but expect rough edges.

Usage

Tests are defined with propcheck-deftest, which defines an ERT test just like ert-deftest.

Your test should generate input values with the propcheck generator functions, then call propcheck-should to make assertions about the result.

(require 'propcheck)

(defun buggy-zerop (num)
  ;; Return t for all values >= 0. This is wrong! We'll claim that 42
  ;; is zero.
  ;;
  ;; There are lots of numbers that produce a wrong result from this
  ;; function, but 1 is the smallest. Ideally propcheck would report 1
  ;; as failing example. It usually does.
  (>= num 0))

(propcheck-deftest buggy-zerop-should-match-zerop ()
  ;; The body of this test will be evaluated repeatedly (up to
  ;; `propcheck-max-examples` times). The value generated will be
  ;; different on each iteration.
  ;;
  ;; If the assertion ever fails, propcheck will call the body again
  ;; with progressively smaller values, then report the smallest
  ;; failing example it could find.
  (let* ((i (propcheck-generate-integer "i")))
    (propcheck-should
     (eq (zerop i)
         (buggy-zerop i)))))

Generators

propcheck provides the following generators:

  • propcheck-generate-bool
  • propcheck-generate-integer
  • propcheck-generate-float
  • propcheck-generate-ascii-char
  • propcheck-generate-proper-list
  • propcheck-generate-vector
  • propcheck-generate-string
  • propcheck-generate-one-of

Using Generators Interactively

Generally you'll want to use propcheck-deftest to handle seeds for you. You can still experiement with generator functions in M-x ielm if you bind propcheck-seed first. Here's an example:

(let ((propcheck-seed (propcheck-seed)))
  (propcheck-generate-string nil)) ; e.g. "M26gM{^*v "
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].