{"id":16375432,"url":"https://github.com/benwoo1110/testcase-maker","last_synced_at":"2025-03-23T03:32:44.000Z","repository":{"id":46573030,"uuid":"405920217","full_name":"benwoo1110/testcase-maker","owner":"benwoo1110","description":"Competitive programming testcases made easy!","archived":false,"fork":false,"pushed_at":"2021-12-31T11:48:30.000Z","size":126,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T17:14:03.369Z","etag":null,"topics":["competitive-programming","hacktoberfest","python","python3","testcase-generator","testcases"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/testcase-maker/","language":"Python","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/benwoo1110.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}},"created_at":"2021-09-13T10:00:51.000Z","updated_at":"2023-08-27T19:57:22.000Z","dependencies_parsed_at":"2022-09-10T02:20:10.847Z","dependency_job_id":null,"html_url":"https://github.com/benwoo1110/testcase-maker","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwoo1110%2Ftestcase-maker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwoo1110%2Ftestcase-maker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwoo1110%2Ftestcase-maker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benwoo1110%2Ftestcase-maker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benwoo1110","download_url":"https://codeload.github.com/benwoo1110/testcase-maker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245052633,"owners_count":20553162,"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":["competitive-programming","hacktoberfest","python","python3","testcase-generator","testcases"],"created_at":"2024-10-11T03:20:50.994Z","updated_at":"2025-03-23T03:32:43.425Z","avatar_url":"https://github.com/benwoo1110.png","language":"Python","readme":"# Testcase Maker\n\n[![Downloads](https://static.pepy.tech/personalized-badge/testcase-maker?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=lightgrey\u0026left_text=Downloads)](https://pepy.tech/project/testcase-maker)\n[![pypi](https://img.shields.io/pypi/v/testcase-maker)](https://pypi.org/project/testcase-maker/)\n[![docs](https://img.shields.io/readthedocs/testcase-maker)](https://testcase-maker.readthedocs.io/en/stable/)\n[![python](https://img.shields.io/pypi/pyversions/testcase-maker)](https://www.python.org/)\n[![license](https://img.shields.io/github/license/benwoo1110/testcase-maker)](https://github.com/benwoo1110/testcase-maker/blob/main/LICENSE)\n\n### Competitive programming testcases made easy!\n\n## About\n**\\*\\*NOTE:  The library is a work-in-progress, there may be breaking changes.**\n\nWhen creating competitive programming challenges, we will also need to create testcases. These testcases may be very \nlarge with millions of numbers, which makes it near impossible to do manually. This library will allow you to automate \nthis process. It provides an intuitive API to build, generate and validate testcases. \n\n#### **Testcase Maker** aims to be:\n\n* Very modular and expandable API structure\n* Fast and efficient\n* Extensive documentation and examples\n\n#### **Testcase Maker** is feature-packed with:\n\n* Highly customisable values to suit large range of challenges\n* Separate constraints for subtasks\n* Execute answer scripts in java, cpp or python to get stdout\n\n## Installation\nThis lib is hosted on pypi, thus you can install this lib by typing the following line:\n```\npip install testcase-maker\n```\n\n## Basics Usage\nYou can get started generating testcases with just a few lines of code. Here is a simple example of generating testcases \nwith N number of random integers, i.\n```python\nimport logging\n\nfrom testcase_maker.generator import TestcaseGenerator\nfrom testcase_maker.values import ValueGroup, NamedValue, RandomInt, LoopValue, ValueRef\n\nlogging.basicConfig(level=logging.INFO)\n\nvalues = ValueGroup()\n# Define the N value.\nvalues.add(NamedValue(name=\"N\", value=RandomInt(min=50, max=1000)))\nvalues.newline()\n# Define the N number of integers.\nvalues.add(LoopValue(\n    value=NamedValue(name=\"i\", value=RandomInt(min=1, max=1000)),\n    amount=ValueRef(\"N\"),\n    delimiter=\" \",\n))\n\n# Generate stdin testcases\ngenerator = TestcaseGenerator(values=values)\ngenerator.generate_stdin()\n```\n\nSome challenges has subtasks with testcases requiring different constraints. Continuing from the previous example, here \nis how you can do it with **Testcase Maker**.\n```python\n# ...replacing generator code from the simple example...\n# Generate stdin testcases\ngenerator = TestcaseGenerator(values=values)\n\n# Reduce the range of both N and i values.\neasy = generator.new_subtask(no_of_testcase=2)\neasy.override_value(name=\"N\", value=RandomInt(min=2, max=5))\neasy.override_value(name=\"i\", value=RandomInt(min=1, max=100))\n\n# Reduce the range of N. Slightly harder but still less than default.\nmedium = generator.new_subtask(no_of_testcase=2)\nmedium.override_value(name=\"N\", value=RandomInt(min=6, max=50))\n\n# Using default constraints. This will generate the largest set of testcases.\nhard = generator.new_subtask(no_of_testcase=2)\n\ngenerator = TestcaseGenerator(values=values)\ngenerator.generate_stdin()\n```\n\nApart from stdin, you can also generate stdout with an answer script. \n```python\n# ...replacing generator code from the simple example...\n# Generate stdin and stdout testcases\ngenerator = TestcaseGenerator(values=values, answer_script=\"./solutions.py\")\ngenerator.generate()\n```\n\n```python\n# solution.py\nN = int(input())\nnumbers = [int(x) for x in input().split()]\nnumbers.sort()\nprint(\" \".join([str(x) for x in numbers]))\n```\n\n## Advanced\nThere are still so many other things you can do with this library. For more advanced and detailed usage guide, please refer to \nthe [official documentation](https://testcase-maker.readthedocs.io/en/stable/)!\n\n## License\nThis project is license with MIT. Read full details at [LICENSE](LICENSE) file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwoo1110%2Ftestcase-maker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenwoo1110%2Ftestcase-maker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwoo1110%2Ftestcase-maker/lists"}