A testcase generator for online judges.
Project description
OjTest - An auto-copied testcase generator for online judges.
Install pip3 install ojtest
Requirements : PyperClip
If you find this project helpful, star it!
Function
1. generate a random list consists of integer values and copy it to the clipboard
- rand_int_list
- rand_int_list_sorted
- rand_int_list_unique
- rand_int_list_sorted_unique
2. generate a random string and copy it to the clipboard
- rand_str
- rand_str_alphabetics
- rand_str_alphabetic_lower
- rand_str_alphabetic_capital
- rand_str_digital
Usage
1. get a string consists of customized char sets(string format)
Default char set is alphabets
import ojtest as oj
import random
random.seed(42)
oj.rand_str(50)
# "GiwCkhgoCuKCOySWewyfgUDwPdZHLOQgESkMqVMaLWckpfVcuy"
oj.rand_str(length=50, char_set='QWERTYqwerty987654')
# "9RyyeW74R9E4ryqEWwrEwR9e7yYyyqeEY4wY79e4wtWwWt9eEq"
2. get a string consists of alphabets
import ojtest as oj
import random
random.seed(42)
oj.rand_str_alphabetic(50)
# or oj.rand_str_alphabetic(length=50)
# or oj.rand_str(50)
# "GiwCkhgoCuKCOySWewyfgUDwPdZHLOQgESkMqVMaLWckpfVcuy"
3. get a list consists of random integer values
By default, min value is 0, and max value is 100
import ojtest as oj
import random
random.seed(42)
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)
# [81, 14, 3, 94, 35, 31, 28, 17, 94, 13]
4. get a list consists of sorted random integer values
By default, min value is 0, and max value is 100
import ojtest as oj
import random
random.seed(42)
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)
# [3, 13, 14, 17, 28, 31, 35, 81, 94, 94]
5. get a list consists of customized sorted random integer values
By default, min value is 0, and max value is 100
import ojtest as oj
from functools import cmp_to_key
import random
random.seed(42)
# 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))
# [94, 94, 81, 35, 31, 28, 17, 14, 13, 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.3.2.tar.gz
(4.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 ojtest-0.0.3.2.tar.gz.
File metadata
- Download URL: ojtest-0.0.3.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8199624d42a917d825f8693e96c54d2b22d66d7b3de431928fc88f3fdddc9fc3
|
|
| MD5 |
88a12ce0a8b5b44abeff13dd5c8de47f
|
|
| BLAKE2b-256 |
ff936e0ae8999d66966e5649e2c39ff2fd28f134aa7fdbff56301a001f1c8584
|
File details
Details for the file ojtest-0.0.3.2-py3-none-any.whl.
File metadata
- Download URL: ojtest-0.0.3.2-py3-none-any.whl
- Upload date:
- Size: 4.7 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 |
8470ad1440ec7d48db6b2572a92c594a8e209356cc2b7592fcea984d011ebf77
|
|
| MD5 |
66ad1d429daab2fbfe60a42c0d9af007
|
|
| BLAKE2b-256 |
d3fda65d47987e4011667e6e87957d5fe6785739133b2d0bf5b1e5e5daac89b1
|