{"id":15578680,"url":"https://github.com/ztl-uwu/py-vtest","last_synced_at":"2026-04-30T00:02:56.681Z","repository":{"id":44919089,"uuid":"399049743","full_name":"ZTL-UwU/py-vtest","owner":"ZTL-UwU","description":"An OI test-data generation \u0026 std test tool.","archived":false,"fork":false,"pushed_at":"2024-01-30T17:42:15.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T07:43:06.421Z","etag":null,"topics":["oi","python","test-data"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZTL-UwU.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-08-23T09:44:57.000Z","updated_at":"2023-07-18T14:21:51.000Z","dependencies_parsed_at":"2024-12-09T09:44:57.823Z","dependency_job_id":"b4d25ae3-7db8-4c05-b893-078735badd61","html_url":"https://github.com/ZTL-UwU/py-vtest","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":"0.30000000000000004","last_synced_commit":"785d40e5782e7a96adfd14db8b787f1f10e0de97"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ZTL-UwU/py-vtest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTL-UwU%2Fpy-vtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTL-UwU%2Fpy-vtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTL-UwU%2Fpy-vtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTL-UwU%2Fpy-vtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZTL-UwU","download_url":"https://codeload.github.com/ZTL-UwU/py-vtest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZTL-UwU%2Fpy-vtest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["oi","python","test-data"],"created_at":"2024-10-02T19:12:14.795Z","updated_at":"2026-04-30T00:02:56.662Z","avatar_url":"https://github.com/ZTL-UwU.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-Vtest\n\n![[LICENSE](https://github.com/ZTL-UwU/py-vtest/blob/main/LICENSE)](https://img.shields.io/github/license/ZTL-UwU/py-vtest?style=flat-square)\n![Code Size](https://img.shields.io/github/languages/code-size/ZTL-UwU/py-vtest?style=flat-square)\n\nAn OI test-data maker \u0026 std test tool.\n\n## Mode\n\n1. **vmake**: Automatically generate test-data with user-provided standard solution and Maker (described below).\n2. **vcheck**: Execute a solution on set of test-data like an OnlineJudge does.\n**WARNING: No sandbox protection, don't run any untrusted code!**\n\n## Maker\n\nA Maker is an executable that generates the input of a single test case.\n\n**How to write a Maker?**\n\n1. Read the subtask ID (starting from 1), a single integer from `stdin`.\n2. Output the input data to `stdout`.\n\n## Usage\n\n1. Create `vtest.conf`.\n\n    **The format of `vtest.conf`**:\n\n    ```plaintext\n    \u003cname\u003e \u003csubtask count\u003e\n    \u003cdata path\u003e\n    \u003ccase count for subtask #1\u003e\n    \u003ccase count for subtask #2\u003e\n    ...\n    \u003ccase count for subtask #n\u003e\n    ```\n\n    **Example**:\n\n    ```plaintext\n    AplusB 5\n    data\n    5\n    15\n    20\n    20\n    40\n    ```\n\n2. The file structure will be like this\n\n    ```plaintext\n    .\n    ├─ \u003cdata path\u003e // Auto Generated\n    │  ├─ \u003cname\u003e.1.1.in\n    │  ├─ \u003cname\u003e.1.1.out\n    │  ├─ ...\n    │  ├─ \u003cname\u003e.\u003csubtask count\u003e.\u003cn\u003e.in\n    │  └─ \u003cname\u003e.\u003csubtask count\u003e.\u003cn\u003e.out\n    │\n    ├─ mk_\u003cname\u003e  // Compile yourself\n    ├─ std_\u003cname\u003e // Compile yourself\n    ├─ run_\u003cname\u003e // Compile yourself\n    ├─ vmake.py   // Downloaded\n    └─ vcheck.py  // Downloaded\n    ```\n\n## Example\n\nHere is a example of generating test-data of the _A + B problem_ and testing a solution of it.\n\n1. Create an empty folder.\n2. Create `vtest.conf` with the following content:\n\n    ```plaintext\n    AplusB 2\n    data\n    6\n    4\n    ```\n\n3. Download `vmake.py` and `vcheck.py`.\n\n    You can use the following commands if you prefer CLI or simply click `Download Zip` in the project repository page and extract `vmake.py` and `vcheck.py`:\n\n    ```bash\n    wget https://github.com/ZTL-UwU/py-vtest/raw/main/vmake.py\n    wget https://github.com/ZTL-UwU/py-vtest/raw/main/vcheck.py\n    ```\n\n4. Create a standard solutoion as an executable named `std_AplusB`.\n\n    For example, the following code is a C++ version of a standard solution of _A + B problem_, compile it into `std_AplusB`:\n\n    ```cpp\n    // std_AplusB.cpp\n    #include \u003ciostream\u003e\n\n    int main() {\n        long long a, b;\n        std::cin \u003e\u003e a \u003e\u003e b;\n        std::cout \u003c\u003c a + b;\n        return 0;\n    }\n    ```\n\n    Compile commands:\n\n    ```bash\n    g++ std_AplusB.cpp -o std_AplusB\n    ```\n\n5. Create an executable named `mk_AplusB` which is a Maker (described above).\n\n    For example, the following is a C++ version of the test-data Maker, compile it into `mk_AplusB`:\n\n    ```cpp\n    // mk_AplusB.cpp\n    #include \u003ciostream\u003e\n    #include \u003crandom\u003e\n\n    int main() {\n        int subtask_id;\n        std::cin \u003e\u003e subtask_id;\n\n        if (subtask_id == 1) {\n            std::mt19937 rng(std::random_device{}());\n            std::cout \u003c\u003c rng() \u003c\u003c \" \" \u003c\u003c rng();\n        }\n\n        if (subtask_id == 2) {\n            // In this subtask, we will generate larger inputs\n\t    // which can hack solutions without using long long.\n            std::mt19937_64 rng(std::random_device{}());\n            std::cout \u003c\u003c rng() \u003c\u003c \" \" \u003c\u003c rng();\n        }\n\n        return 0;\n    }\n    ```\n\n    Compile commands:\n\n    ```bash\n    g++ mk_AplusB.cpp -o mk_AplusB\n    ```\n\n6. Run `vmake.py`.\n\n    You can use the following command or simply double-click on `vmake.py`:\n\n    ```bash\n    python3 vmake.py\n    ```\n\n    The output is similar to the following:\n\n    ```plaintext\n    Start Making data for AplusB.\n\n    Making subtask #1\n        [ 10%] Made case #1.1: (9.0ms)\n        [ 20%] Made case #1.2: (2.17ms)\n        [ 30%] Made case #1.3: (5.08ms)\n        [ 40%] Made case #1.4: (2.53ms)\n        [ 50%] Made case #1.5: (4.01ms)\n        [ 60%] Made case #1.6: (3.81ms)\n    Making subtask #2\n        [ 70%] Made case #2.1: (1.99ms)\n        [ 80%] Made case #2.2: (3.06ms)\n        [ 90%] Made case #2.3: (2.04ms)\n        [100%] Made case #2.4: (3.4ms)\n\n    Summary:\n        Slowest case: #1.1 (9.0ms)\n    ```\n\n    Now you can see the generated data in the `data` folder.\n    \n    ```\n    .\n    ├─ data\n    |  ├─ AplusB.1.1.in\n    |  ├─ AplusB.1.1.out\n    |  ├─ ...\n    |  ├─ AplusB.2.4.in\n    |  └─ AplusB.2.4.out\n    ```\n\n7. Lets try another solution without using `long long` (who cannot pass the test).\n\n    This is a C++ version of a wrong solution, compile it into `run_AplusB`:\n\n    ```cpp\n    // AplusB_wrong.cpp\n    #include \u003ciostream\u003e\n\n    int main() {\n        int a, b;\n        std::cin \u003e\u003e a \u003e\u003e b;\n        std::cout \u003c\u003c a + b;\n        return 0;\n    }\n    ```\n\n    Compile commands:\n\n    ```bash\n    g++ AplusB_wrong.cpp -o run_AplusB\n    ```\n\n8. Run `vcheck.py`\n\n    You can use the following command or simply double-click on `vcheck.py`:\n\n    ```bash\n    python3 vcheck.py\n    ```\n\n    The output is similar to the following:\n\n    ```plaintext\n    Start checking subtask #1\n        [ 10%] Case #1.1: Answer Correct (2.56ms)\n        [ 20%] Case #1.2: Answer Correct (2.33ms)\n        [ 30%] Case #1.3: Answer Correct (2.6ms)\n        [ 40%] Case #1.4: Answer Correct (7.18ms)\n        [ 50%] Case #1.5: Answer Correct (2.22ms)\n        [ 60%] Case #1.6: Answer Correct (2.24ms)\n    Start checking subtask #2\n        [ 70%] Case #2.1:  Wrong Answer  (3.17ms)\n        [ 80%] Case #2.2:  Wrong Answer  (2.85ms)\n        [ 90%] Case #2.3:  Wrong Answer  (2.28ms)\n        [100%] Case #2.4:  Wrong Answer  (2.76ms)\n\n    Summary: WA\n        Total time: 30.2ms\n        Slowest case: #1.4 (7.18ms)\n    --------------------------------\n        AC:   6 [ 60%]\n        WA:   4 [ 40%]\n        RE:   0 [  0%]\n    ```\n\n## Todo\n\n1. Add `.exe` suffix on Windows in `vcheck.py` and `vhack.py`. (see #2)\n1. Introduce `vhack.py` in README.\n1. Add a `zh-cn` version of the README introduction.\n1. Extract shared codes in `vmake.py`, `vhack.py` and `vcheck.py`.\n1. Auto generate subtask configuration files for HustOJ, LibraOJ, HydroOJ and more (maybe `vconf.py` ?).\n1. Use command-line arguments rather that fixed `std_xxx`, `mk_xxx` stuff.\n1. Check inputs with a codeforces styled validator (maybe `vvalidate.py` ?).\n1. Write an introduction and documention about libvmake.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztl-uwu%2Fpy-vtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fztl-uwu%2Fpy-vtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztl-uwu%2Fpy-vtest/lists"}