Skip to main content

A testcase generator for online judges.

Project description

OjTest - An auto-copied testcase generator for online judges.

Install pip3 install ojtest
If you find this project helpful, star it!


Function

1. generate a random list consists of integer values and copy it to the clipboard

  1. rand_int_list
  2. rand_int_list_sorted
  3. rand_int_list_unique
  4. rand_int_list_sorted_unique

2. generate a random string and copy it to the clipboard

  1. rand_str
  2. rand_str_alphabetics
  3. rand_str_alphabetic_lower
  4. rand_str_alphabetic_capital
  5. rand_str_digital

Usage

1. get a string consists of customized char sets(string format)

Default char set is alphabets

import ojtest as oj

oj.rand_str(50)
# "JrtnUhQmUDZTunRTHYIbZyDGNemOYrArXrTIABczpbiurISfaR"

oj.rand_str(length=50, char_set='QWERTYqwerty987654')
# "Rte68ryYeR68e7T87T9Y5tetY687Rr7Tr5t5TWQE684TrQ45Wq"

2. get a string consists of alphabets

import ojtest as oj

oj.rand_str_alphabetic(50)
# or oj.rand_str_alphabetic(length=50)
# or oj.rand_str(50)
# "UfAdzVUbzTxsVvLzOIgjPoMULRymXynTceMdqaxeQFLASxWCEn"

3. get a list consists of random integer values

By default, min value is 0, and max value is 100

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]

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

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]

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

# 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


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.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ojtest-0.0.3.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file ojtest-0.0.3.1.tar.gz.

File metadata

  • Download URL: ojtest-0.0.3.1.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

Hashes for ojtest-0.0.3.1.tar.gz
Algorithm Hash digest
SHA256 93579b816d85ed649a65dd703e7e68558abec33170ea9fd5be93b2c474f24b5f
MD5 bf170d2e9fa7b3eb940fdc1cffeb4dfe
BLAKE2b-256 83bdfa793129a215b21c3c876717c9c3dbde60e0e6ec586439bfe25d2148901a

See more details on using hashes here.

File details

Details for the file ojtest-0.0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ojtest-0.0.3.1-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

Hashes for ojtest-0.0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a389493d28457514f04f889343f2e89ad806b182fa667538fd37d1d7b2ad5823
MD5 cb45b244a23028c122a98383b5c4e2b8
BLAKE2b-256 1d98ed7b3fdb3d8af2f4691b3437bd9bbdc74cf5dd8793f18435c6d5674f596f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page