HackGen: Hackerrank Test-Case Generator
Generate test cases for your HackrRank challenge. You need your solution algorithm, input format and constraints only. Generate the zipped file and upload :)
Installation
$ pip install hackgen
Example usage
>>> import random
>>> from hackgen import TestInputFormat, TestGenerator, Language
>>> class ClockDelayInputFormat(TestInputFormat):
>>> """
>>> Input format of Clock Delay challenge.
>>> https://www.hackerrank.com/contests/hourrank-28/challenges/clock-delay
>>> """
>>>
>>> # difficulty levels with test file number
>>> # difficulty level is [0-9]
>>> __diff = [(5, 10), (10, 30), (50, 100), (100, 300), (100, 300),
>>> (300, 600), (600, 900), (800, 1000), (900, 1000), (950, 1000)]
>>>
>>> def inputs(self, difficult_level: int) -> None:
>>> q = random.randint(*self.__diff[difficult_level]) # number of test cases
>>> print(q)
>>> for n in range(q):
>>> # constraints for h1 m1 h2 m2 k
>>> h1 = random.randint(0, 23)
>>> m1 = random.randint(0, 60)
>>> h2 = random.randint(h1, 24)
>>> k = random.randint(h2 - h1 + 1 if h1 == h2 else h2 - h1, 24 - h1)
>>> m2 = random.randint(0, (m1 if h1 + k == h2 else 60))
>>> print(h1, m1, h2, m2)
>>> print(k)
>>>
>>> # input format instance
>>> input_format = ClockDelayInputFormat()
>>>
>>> # try with Language.java('Logic') also
>>> test_generator = TestGenerator(10, input_format, Language.python('logic'), "ClockDelay")
>>> test_generator.run()
Metadata
Release files for hackgen 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hackgen-1.0.1.tar.gz | 3.0 kB | Without provenance | Details for hackgen-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hackgen-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for hackgen-1.0.1-py3-none-any.whl |
Total release size: 7.5 kB
Release files / hackgen-1.0.1.tar.gz
| Download URL | hackgen-1.0.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cfa926840618a1fc1109ef910cbe68edb091a7592d81e73f193162d7c86d2f38
|
|
BLAKE2b-256 checksum How to use checksums |
fe4e1431807ce1d6ea04b5bba10314cf09d0c3a4000905616af42ada271f2f08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
|
Release files / hackgen-1.0.1-py3-none-any.whl
| Download URL | hackgen-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c22916fcce302258349e9ecc11d34efaf4cba2c95034fc17581809d2a58ca853
|
|
BLAKE2b-256 checksum How to use checksums |
f229a7293c91292db1b1440414ebed6c0ad545e568f7fd3ffbd6305985ed6cd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
|
Security for hackgen 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.