{"id":18387565,"url":"https://github.com/j5ik2o/prop-check-rs","last_synced_at":"2026-06-08T02:05:07.123Z","repository":{"id":37022006,"uuid":"319360009","full_name":"j5ik2o/prop-check-rs","owner":"j5ik2o","description":"A Rust crate for property-based testing.","archived":false,"fork":false,"pushed_at":"2026-05-25T00:39:56.000Z","size":486,"stargazers_count":8,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-25T02:30:03.243Z","etag":null,"topics":["property-based-testing","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/j5ik2o.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-12-07T15:21:07.000Z","updated_at":"2026-05-25T00:39:29.000Z","dependencies_parsed_at":"2026-03-09T02:06:00.815Z","dependency_job_id":null,"html_url":"https://github.com/j5ik2o/prop-check-rs","commit_stats":{"total_commits":343,"total_committers":4,"mean_commits":85.75,"dds":"0.12244897959183676","last_synced_commit":"c669c0a39b2793b5b1fe32af6b8f5d2f18ed9381"},"previous_names":[],"tags_count":999,"template":false,"template_full_name":null,"purl":"pkg:github/j5ik2o/prop-check-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j5ik2o%2Fprop-check-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j5ik2o%2Fprop-check-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j5ik2o%2Fprop-check-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j5ik2o%2Fprop-check-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j5ik2o","download_url":"https://codeload.github.com/j5ik2o/prop-check-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j5ik2o%2Fprop-check-rs/sbom","scorecard":{"id":326151,"data":{"date":"2025-08-11","repo":{"name":"github.com/j5ik2o/prop-check-rs","commit":"b120c4505e002ec5510e8e4a26fcc7122d0077c5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.2,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bump-version.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/bump-version.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/bump-version.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/bump-version.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/bump-version.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/bump-version.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/bump-version.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/bump-version.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bump-version.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/bump-version.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/j5ik2o/prop-check-rs/release.yml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":10,"reason":"21 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/bump-version.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yml:9"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T02:31:41.747Z","repository_id":37022006,"created_at":"2025-08-18T02:31:41.747Z","updated_at":"2025-08-18T02:31:41.747Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34044920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":["property-based-testing","rust"],"created_at":"2024-11-06T01:26:45.651Z","updated_at":"2026-06-08T02:05:07.101Z","avatar_url":"https://github.com/j5ik2o.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prop-check-rs\n\nprop-check-rsは、Rustで書かれたプロパティベーステスト用のライブラリです。関数型プログラミングの概念を活用し、テストデータの生成と検証を効率的に行うことができます。\n\n*他の言語で読む: [English](README.md)*\n\n[![Workflow Status](https://github.com/j5ik2o/prop-check-rs/workflows/ci/badge.svg)](https://github.com/j5ik2o/prop-check-rs/actions?query=workflow%3A%22ci%22)\n[![crates.io](https://img.shields.io/crates/v/prop-check-rs.svg)](https://crates.io/crates/prop-check-rs)\n[![docs.rs](https://docs.rs/prop-check-rs/badge.svg)](https://docs.rs/prop-check-rs)\n[![tokei](https://tokei.rs/b1/github/j5ik2o/prop-check-rs)](https://github.com/XAMPPRocky/tokei)\n\n## プロパティベーステストとは\n\nプロパティベーステストは、特定の入力値に対するテストではなく、プログラムが満たすべき性質（プロパティ）を定義し、ランダムに生成された多数の入力値に対してそのプロパティが成り立つかを検証するテスト手法です。これにより、開発者が想定していないエッジケースを発見しやすくなります。\n\n## 特徴\n\n- 豊富なジェネレータ：様々な型のテストデータを簡単に生成\n- 関数型プログラミングスタイル：モナドを活用した合成可能なAPI\n- 状態ベースのテスト：状態機械のシミュレーションをサポート\n- 高度なカスタマイズ：独自のジェネレータやプロパティを定義可能\n\n## インストール\n\nCargo.tomlに以下を追加してください：\n\n```toml\n[dependencies]\nprop-check-rs = \"0.0.862\"\n```\n\n## 基本的な使い方\n\n### 1. 単純なプロパティテスト\n\n以下は、リストの長さに関するプロパティをテストする例です：\n\n```rust\nuse prop_check_rs::gen::Gens;\nuse prop_check_rs::prop::{for_all_gen, test_with_prop};\nuse prop_check_rs::rng::RNG;\nuse anyhow::Result;\n\n#[test]\nfn test_list_length_property() -\u003e Result\u003c()\u003e {\n    // 0から100までの整数のリストを生成するジェネレータ\n    let gen = Gens::list_of_n(10, Gens::choose_i32(0, 100));\n    \n    // プロパティ：リストの長さは常に10\n    let prop = for_all_gen(gen, |list| {\n        list.len() == 10\n    });\n    \n    // プロパティをテスト（最大サイズ1、100回のテストケース）\n    test_with_prop(prop, 1, 100, RNG::new())\n}\n```\n\n### 2. 値の選択\n\n```rust\nuse prop_check_rs::gen::Gens;\nuse prop_check_rs::prop::{for_all_gen, test_with_prop};\nuse prop_check_rs::rng::RNG;\nuse anyhow::Result;\n\n#[test]\nfn test_one_of() -\u003e Result\u003c()\u003e {\n    // 指定された文字のいずれかを選択するジェネレータ\n    let gen = Gens::one_of_values(['a', 'b', 'c', 'x', 'y', 'z']);\n    \n    // プロパティ：選択された文字は常に指定された文字のいずれか\n    let prop = for_all_gen(gen, move |value| {\n        log::info!(\"value = {}\", value);\n        ['a', 'b', 'c', 'x', 'y', 'z'].contains(\u0026value)\n    });\n    \n    test_with_prop(prop, 1, 100, RNG::new())\n}\n```\n\n### 3. サイズ付きジェネレータの使用\n\n```rust\nuse prop_check_rs::gen::Gens;\nuse prop_check_rs::prop::{for_all_gen_for_size, test_with_prop};\nuse prop_check_rs::rng::RNG;\nuse anyhow::Result;\n\n#[test]\nfn test_sized_generator() -\u003e Result\u003c()\u003e {\n    let gen = Gens::one_of_values(['a', 'b', 'c', 'x', 'y', 'z']);\n    \n    // サイズに基づいてリストを生成\n    let prop = for_all_gen_for_size(\n        move |size| Gens::list_of_n(size as usize, gen.clone()),\n        move || {\n            move |list| {\n                // リストの長さがサイズと一致することを確認\n                log::info!(\"list = {:?}\", list);\n                true\n            }\n        },\n    );\n    \n    // 最大サイズ10、100回のテストケース\n    test_with_prop(prop, 10, 100, RNG::new())\n}\n```\n\n## 主要なコンポーネント\n\n### Gen\u003cA\u003e\n\n`Gen\u003cA\u003e`は型`A`の値を生成するジェネレータです。`map`、`flat_map`、`and_then`などのメソッドを提供し、既存のジェネレータから新しいジェネレータを作成できます。\n\n```rust\n// 1から100までの整数を生成するジェネレータ\nlet int_gen = Gens::choose_i32(1, 100);\n\n// 整数を文字列に変換するジェネレータ\nlet string_gen = int_gen.map(|n| n.to_string());\n```\n\n### Gens\n\n`Gens`は様々なジェネレータを作成するためのファクトリです。以下のようなジェネレータを提供しています：\n\n- 基本型（整数、浮動小数点、文字、真偽値など）\n- リスト\n- オプション値\n- 複数の選択肢から一つを選ぶ\n- 確率に基づく選択\n\n```rust\n// 基本型のジェネレータ\nlet int_gen = Gens::one_i32();\nlet float_gen = Gens::one_f64();\nlet bool_gen = Gens::one_bool();\n\n// 範囲を指定したジェネレータ\nlet range_gen = Gens::choose_i32(1, 100);\n\n// リストのジェネレータ\nlet list_gen = Gens::list_of_n(10, range_gen);\n\n// 複数の選択肢から一つを選ぶジェネレータ\nlet choice_gen = Gens::one_of_values([\"apple\", \"banana\", \"orange\"]);\n\n// 確率に基づくジェネレータ\nlet weighted_gen = Gens::frequency_values([(1, \"rare\"), (5, \"common\"), (2, \"uncommon\")]);\n```\n\n### Prop\n\n`Prop`はプロパティを表す構造体です。プロパティは、ジェネレータによって生成された値に対して検証する条件を定義します。\n\n```rust\n// 整数が常に正であることを検証するプロパティ\nlet positive_prop = for_all_gen(Gens::choose_i32(1, 100), |n| n \u003e 0);\n\n// 複数のプロパティを組み合わせる\nlet combined_prop = positive_prop.and(another_prop);\n```\n\n### State\u003cS, A\u003e\n\n`State\u003cS, A\u003e`は状態`S`を持ち、値`A`を生成する計算を表すモナドです。これにより、状態を保持しながら計算を合成することができます。\n\n```rust\n// 状態を取得する\nlet get_state = State::\u003ci32, i32\u003e::get();\n\n// 状態を設定する\nlet set_state = State::\u003ci32, ()\u003e::set(42);\n\n// 状態を変更する\nlet modify_state = State::\u003ci32, ()\u003e::modify(|s| s + 1);\n\n// 状態付き計算を合成する\nlet computation = get_state.flat_map(|s| {\n    if s \u003e 0 {\n        State::pure(s * 2)\n    } else {\n        State::pure(0)\n    }\n});\n```\n\n## 高度な使用例\n\n### 状態機械のテスト\n\n`machine.rs`モジュールは、状態機械をシミュレートする例を提供しています。以下は、キャンディ販売機のシミュレーション例です：\n\n```rust\n// 入力\nenum Input {\n    Coin,\n    Turn,\n}\n\n// 状態機械\nstruct Machine {\n    locked: bool,\n    candies: i32,\n    coins: i32,\n}\n\n// 状態機械のシミュレーション\nlet inputs = vec![Input::Coin, Input::Turn, Input::Coin, Input::Turn];\nlet simulation = Machine::simulate_machine(inputs);\nlet result = simulation.run(Machine { locked: true, candies: 5, coins: 10 });\n```\n\n### カスタムジェネレータの作成\n\n独自のジェネレータを作成することで、特定のドメインに特化したテストデータを生成できます：\n\n```rust\n// 有効なメールアドレスを生成するジェネレータ\nfn email_gen() -\u003e Gen\u003cString\u003e {\n    let username_gen = Gens::list_of_n(8, Gens::choose_char('a', 'z'))\n        .map(|chars| chars.into_iter().collect::\u003cString\u003e());\n    \n    let domain_gen = Gens::one_of_values([\"example.com\", \"test.org\", \"mail.net\"]);\n    \n    username_gen.and_then(domain_gen, |username, domain| {\n        format!(\"{}@{}\", username, domain)\n    })\n}\n\n// 使用例\nlet prop = for_all_gen(email_gen(), |email| {\n    // メールアドレスの検証ロジック\n    email.contains('@')\n});\n```\n\n## ベンチマーク\n\nprop-check-rsは、大量のテストデータを効率的に生成するための最適化が施されています。ベンチマークを実行するには：\n\n```bash\ncargo bench\n```\n\n## ライセンス\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj5ik2o%2Fprop-check-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj5ik2o%2Fprop-check-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj5ik2o%2Fprop-check-rs/lists"}