HackerRank Test-Case Generator
Project description
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hackgen-1.0.1.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hackgen-1.0.1.tar.gz.
File metadata
- Download URL: hackgen-1.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfa926840618a1fc1109ef910cbe68edb091a7592d81e73f193162d7c86d2f38
|
|
| MD5 |
5593e99cdc801c50b7860cb1ca42c7da
|
|
| BLAKE2b-256 |
fe4e1431807ce1d6ea04b5bba10314cf09d0c3a4000905616af42ada271f2f08
|
File details
Details for the file hackgen-1.0.1-py3-none-any.whl.
File metadata
- Download URL: hackgen-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c22916fcce302258349e9ecc11d34efaf4cba2c95034fc17581809d2a58ca853
|
|
| MD5 |
ac650b0e5ffa702968996f8f418a102a
|
|
| BLAKE2b-256 |
f229a7293c91292db1b1440414ebed6c0ad545e568f7fd3ffbd6305985ed6cd7
|