{"id":19439094,"url":"https://github.com/spacejam/test-idioms","last_synced_at":"2025-08-08T21:07:03.726Z","repository":{"id":189688016,"uuid":"681085704","full_name":"spacejam/test-idioms","owner":"spacejam","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-21T09:50:31.000Z","size":8,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-22T20:40:11.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/spacejam.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}},"created_at":"2023-08-21T08:27:00.000Z","updated_at":"2024-08-03T06:16:39.000Z","dependencies_parsed_at":"2023-08-21T11:10:02.038Z","dependency_job_id":"a40ddde6-4ba7-450a-a011-47df58c21197","html_url":"https://github.com/spacejam/test-idioms","commit_stats":null,"previous_names":["spacejam/test-idioms"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spacejam/test-idioms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Ftest-idioms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Ftest-idioms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Ftest-idioms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Ftest-idioms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacejam","download_url":"https://codeload.github.com/spacejam/test-idioms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Ftest-idioms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268849535,"owners_count":24317213,"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","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-10T15:21:16.460Z","updated_at":"2025-08-08T21:07:03.656Z","avatar_url":"https://github.com/spacejam.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# test-idioms\n\nAn example crate layout for separating generative testing concerns to improve code reuse across different history generators,\ninvariants, and history execution strategies. It is nice to keep as many testing concerns as possible out of the main business\nlogic crate.\n\nAdditionally, this really demonstrates the power of libfuzzer. Two generative test frameworks execute the same shared actions, invariants and execution strategies defined in the `shared_correctness_logic` subdirectory, where the default `arbitrary::Arbitrary` and `proptest_derive::Arbitrary` traits are\nderived on the shared workload struct (and could be manually defined there, too, if desired).\n\nWhen running `cargo test` from the root directory, proptest runs with its default configuration and does not find the\nbug, which is only triggered on a specific `u64` being input into the system. However, when running cargo fuzz via\n`cargo +nightly fuzz run my_fuzz_target` (after installing cargo fuzz with `cargo install cargo-fuzz`) then the\nbinary instrumentation is able to rapidly converge on the specific `u64` that causes a bug to express.\n\nWhile this example has a very large test code : production code ratio due to the production code being nearly nonexistent,\nthe test code is mostly boilerplate that does not grow with system complexity, and by decoupling invariants from\nexecution strategy or workloads, it allows different tests to be written and quickly executed without needing to\nadd conditional compilation to the production code, or relying on deeply nested `#cfg(test)` inclusion etc...\n\n```\n├── Cargo.lock\n├── Cargo.toml\n├── README.md\n├── fuzz\n│   ├── Cargo.lock\n│   ├── Cargo.toml\n│   ├── artifacts\n│   │   └── my_fuzz_target\n│   │       ├── (found crashes accumulate here)\n│   ├── corpus\n│   │   └── my_fuzz_target\n│   │       └── (fuzzing corpus accumulates here)\n│   └── fuzz_targets\n│       └── my_fuzz_target.rs                       \u003c- fuzz test\n├── shared_correctness_logic\n│   ├── Cargo.lock\n│   ├── Cargo.toml\n│   └── src\n│       └── lib.rs                                  \u003c- shared externally visible testing concerns\n├── src\n│   ├── bin\n│   │   └── my_binary.rs                            \u003c- business logic binary\n│   └── lib.rs                                      \u003c- business logic code\n└── tests\n    └── proptest.rs                                 \u003c- proptest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacejam%2Ftest-idioms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacejam%2Ftest-idioms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacejam%2Ftest-idioms/lists"}