{"id":13861635,"url":"https://github.com/Wilfred/propcheck","last_synced_at":"2025-07-14T09:32:50.677Z","repository":{"id":66760548,"uuid":"153030255","full_name":"Wilfred/propcheck","owner":"Wilfred","description":"Quickcheck/hypothesis style testing for elisp","archived":false,"fork":false,"pushed_at":"2021-03-01T01:43:34.000Z","size":109,"stargazers_count":58,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-19T10:42:38.784Z","etag":null,"topics":["emacs-lisp","hypothesis-testing","quickcheck"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wilfred.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-15T00:02:22.000Z","updated_at":"2024-05-12T09:18:33.000Z","dependencies_parsed_at":"2023-02-24T20:01:15.144Z","dependency_job_id":null,"html_url":"https://github.com/Wilfred/propcheck","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Fpropcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Fpropcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Fpropcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wilfred%2Fpropcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wilfred","download_url":"https://codeload.github.com/Wilfred/propcheck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225968846,"owners_count":17553147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs-lisp","hypothesis-testing","quickcheck"],"created_at":"2024-08-05T06:01:26.767Z","updated_at":"2024-11-22T21:30:55.703Z","avatar_url":"https://github.com/Wilfred.png","language":"Emacs Lisp","readme":"# propcheck [![Coverage Status](https://coveralls.io/repos/github/Wilfred/propcheck/badge.svg?branch=master)](https://coveralls.io/github/Wilfred/propcheck?branch=master)\n\npropcheck brings property based testing to elisp.\n\nIt's similar to the excellent [Hypothesis](https://hypothesis.works/)\nlibrary for Python.\n\nStatus: beta. It works, but expect rough edges.\n\n## Usage\n\nTests are defined with `propcheck-deftest`, which defines an ERT test\njust like `ert-deftest`.\n\nYour test should generate input values with the propcheck generator\nfunctions, then call `propcheck-should` to make assertions about the\nresult.\n\n```emacs-lisp\n(require 'propcheck)\n\n(defun buggy-zerop (num)\n  ;; Return t for all values \u003e= 0. This is wrong! We'll claim that 42\n  ;; is zero.\n  ;;\n  ;; There are lots of numbers that produce a wrong result from this\n  ;; function, but 1 is the smallest. Ideally propcheck would report 1\n  ;; as failing example. It usually does.\n  (\u003e= num 0))\n\n(propcheck-deftest buggy-zerop-should-match-zerop ()\n  ;; The body of this test will be evaluated repeatedly (up to\n  ;; `propcheck-max-examples` times). The value generated will be\n  ;; different on each iteration.\n  ;;\n  ;; If the assertion ever fails, propcheck will call the body again\n  ;; with progressively smaller values, then report the smallest\n  ;; failing example it could find.\n  (let* ((i (propcheck-generate-integer \"i\")))\n    (propcheck-should\n     (eq (zerop i)\n         (buggy-zerop i)))))\n```\n\n## Generators\n\npropcheck provides the following generators:\n\n* `propcheck-generate-bool`\n* `propcheck-generate-integer`\n* `propcheck-generate-float`\n* `propcheck-generate-ascii-char`\n* `propcheck-generate-proper-list`\n* `propcheck-generate-vector`\n* `propcheck-generate-string`\n* `propcheck-generate-one-of`\n\n### Using Generators Interactively\n\nGenerally you'll want to use `propcheck-deftest` to handle seeds for\nyou. You can still experiement with generator functions in `M-x ielm`\nif you bind `propcheck-seed` first. Here's an example:\n\n``` emacs-lisp\n(let ((propcheck-seed (propcheck-seed)))\n  (propcheck-generate-string nil)) ; e.g. \"M26gM{^*v \"\n```\n\n","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWilfred%2Fpropcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWilfred%2Fpropcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWilfred%2Fpropcheck/lists"}