A testcase generator for online judges.
Project description
OjTest - A testcase generator for online judges.
Install pip3 install ojtest
If you find this project helpful, star it!
Functions
1. generate a random list consists of integer values
- rand_int_list
- rand_int_list_sorted
- rand_int_list_unique
- rand_int_list_sorted_unique
2. generate a random string
- rand_str_alphabetics
- rand_str_alphabetic_lower
- rand_str_alphabetic_capital
- rand_str_digital
Usage
1. get a string consists of alphabets
import ojtest as oj
oj.rand_str_alphabetic(50)
# oj.rand_str_alphabetic(length=50)
# "UfAdzVUbzTxsVvLzOIgjPoMULRymXynTceMdqaxeQFLASxWCEn"
2. get a list consists of random integer values
import ojtest as oj
oj.rand_int_list(10, 0, 100)
# or oj.rand_int_list(10) # default min_val = 0, max_val = 100
# or oj.rand_int_list(length=10, min_val=0, max_val=100)
# [32, 74, 60, 33, 31, 84, 64, 43, 63, 34]
3. get a list consists of sorted random integer values
import ojtest as oj
oj.rand_int_list_sorted(10, 0, 100)
# or oj.rand_int_list_sorted(10)
# or oj.rand_int_list_sorted(length=10, min_val=0, max_val=100)
# [5, 19, 35, 37, 46, 64, 69, 75, 78, 91]
4. get a list consists of customized sorted random integer values
import ojtest as oj
from functools import cmp_to_key
# decreasing sort
key = cmp_to_key(lambda x, y: y - x)
oj.rand_int_list_sorted(10, 0, 100, key = key)
# oj.rand_int_list_sorted(length=10, min_val=0, max_val=100, key = cmp_to_key(lambda x, y: y - x))
# [88, 67, 53, 49, 22, 21, 20, 18, 4, 3]
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
ojtest-0.0.2.2.tar.gz
(3.8 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 ojtest-0.0.2.2.tar.gz.
File metadata
- Download URL: ojtest-0.0.2.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6562bc3b2bcf1700be7c4063de7c0726476d2a4009093aa397aeebfd7b682d46
|
|
| MD5 |
8c32409e1439bced2d40131aba5d9e10
|
|
| BLAKE2b-256 |
12f05873276e5a27d11b0bfa49620ffb81ade66f8430622d9bf1bda20152e807
|
File details
Details for the file ojtest-0.0.2.2-py3-none-any.whl.
File metadata
- Download URL: ojtest-0.0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0750df90ac21f01dc87526cd83a1ef8bb60fdc99419265ac057fb332bc138fe8
|
|
| MD5 |
773746e0df5afa07399f728178130b7a
|
|
| BLAKE2b-256 |
6efa2aa3690b257ff4e97f06310af208bda25cdb9d0edf2134e4cdf3c5d08372
|