{"id":14187338,"url":"https://github.com/aiken-lang/fuzz","last_synced_at":"2025-04-19T15:17:02.318Z","repository":{"id":225826322,"uuid":"766687347","full_name":"aiken-lang/fuzz","owner":"aiken-lang","description":"A library for writing Fuzzers for property-based testing in Aiken","archived":false,"fork":false,"pushed_at":"2024-11-01T14:10:00.000Z","size":141,"stargazers_count":6,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-01T15:18:45.961Z","etag":null,"topics":["aiken","fuzzer","property-based-testing","testing"],"latest_commit_sha":null,"homepage":"https://aiken-lang.github.io/fuzz/","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aiken-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-03T23:19:52.000Z","updated_at":"2024-10-07T13:45:39.000Z","dependencies_parsed_at":"2024-03-04T14:49:02.508Z","dependency_job_id":"97018021-2b43-4bca-a572-5611c2649867","html_url":"https://github.com/aiken-lang/fuzz","commit_stats":null,"previous_names":["aiken-lang/fuzz"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiken-lang%2Ffuzz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiken-lang%2Ffuzz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiken-lang%2Ffuzz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiken-lang%2Ffuzz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiken-lang","download_url":"https://codeload.github.com/aiken-lang/fuzz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224958559,"owners_count":17398500,"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":["aiken","fuzzer","property-based-testing","testing"],"created_at":"2024-08-18T15:01:07.810Z","updated_at":"2025-04-19T15:17:02.305Z","avatar_url":"https://github.com/aiken-lang.png","language":"Nix","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003chr /\u003e\n    \u003ch2 align=\"center\" style=\"border-bottom: none\"\u003e\u003cimg style=\"position: relative; top: 0.25rem;\" src=\"https://raw.githubusercontent.com/aiken-lang/branding/main/assets/icon.png\" alt=\"Aiken\" height=\"30\" /\u003e aiken/fuzz\u003c/h2\u003e\n\n[![Licence](https://img.shields.io/github/license/aiken-lang/fuzz?style=for-the-badge)](https://github.com/aiken-lang/fuzz/blob/main/LICENSE)\n[![Continuous Integration](https://img.shields.io/github/actions/workflow/status/aiken-lang/fuzz/continuous-integration.yml?style=for-the-badge)](https://github.com/aiken-lang/fuzz/actions/workflows/continuous-integration.yml)\n  \u003chr/\u003e\n\u003c/div\u003e\n\nThe official library for writing _fuzzers_ (a.k.a generators) for the [Aiken](https://aiken-lang.org) Cardano\nsmart-contract language.\n\nIt provides many useful primitives for writing and composing arbitrary generators in the context of [property-based testing](https://en.wikipedia.org/wiki/Property_testing).\n\n## Installation\n\n```\naiken add aiken-lang/fuzz --version v2\n```\n\n## Compatibility\n\naiken's version | fuzz's version(s)\n---             | ---\n$\u003e=$ `v1.1.15`  | `2.2.0`\n$\u003e=$ `v1.1.13`  | `2.1.1`, `2.1.0`\n$\u003e=$ `v1.1.0`   | `1.0.0`\n\n## Getting started\n\nFirst, make sure you have the [Aiken's user manual about tests](https://aiken-lang.org/language-tour/tests#property-based-test); in particular the section about property-based test.\n\nIn many situations, you can use primitives from this library out-of-the-box, composing them inline when necessary. For example, if you need a non-empty list of values, you can simply write:\n\n```\nuse aiken/fuzz\n\ntest my_prop(xs via fuzz.list_between(fuzz.int(), 1, 10)) {\n  // some property\n}\n```\n\nYou can also write your own more complex fuzzer. Note that writing good fuzzers can be complicated, so here are a few guiding principles you should follow if you want them to be (a) effective and (b) easy to simplify for the test runner:\n\n1. Ensure that _smaller values_ lead to _smaller fuzzers_. For example, if you're constructing a compound structure and you draw a value for the size, ensure that smaller values generate smaller structures. This is because the simplification simplifies towards 0.\n\n2. Avoid fuzzers depending on far-away fuzzers. For example, you can write a fuzzer for generating list of values in mainly two ways: you can generate a random length, and then, a number of elements corresponding to that length. Or you can flip a coin, and each time choose to generate another element or to stop. The former is more intuitive, but the latter will produce lists that are easier to simplify.\n\n3. Test your fuzzers! Use `label`, and ensure that the distribution of cases is what you expect it to be. Ensure that you go through specific scenarios. Writing fuzzers that omit crucial parts of the input domain is, unfortunately, quite easy.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiken-lang%2Ffuzz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiken-lang%2Ffuzz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiken-lang%2Ffuzz/lists"}