Skip to main content

Test case generator. Quickly design and generate test cases without all the bulk

Project description

tcgen

Yet another test case generator (But hopefully better)

Quickly and painlessly generate testcases with a minimal amount of code

Installation

python3.7 -m pip install cp-tcgen

Capabilities

tcgen creates several endpoints to generate data with several different methods

Primitives

Primitive
Integer
Bool
Float
Char
Prime

Datatypes

Array
String
NonDecreasing
StrictlyIncreasing
Permutation
Graph
Tree
LineGraph
Grid
DAG
StarGraph
KRegularTree

Examples

https://dmoj.ca/problem/dpa

from tcgen import *
# Bounds are 1..1e5 by default
N = Integer(2, 100000)
print(N)
print(Array(N, Integer(10000)))

https://dmoj.ca/problem/dpb

from tcgen import *
class Gen(Generator):
    def generate(self, case_num):
        N = Integer(L=2, wcnt=20)  # Weighted random
        K = Integer(100)
        self.p(N, K)
        self.p(Array(N, U=10000))

gen = Gen()
print(gen.get_test_cases(10))
print(gen.get_test_case())
from tcgen import *
A, B = Integer(), Integer()
print(A, B)
# 1 <= N <= A+B
N = Integer(A + B)
print(N)
from tcgen import *
N = Integer()
print(N)
M = Integer(2 * N)
print(M)
print(Graph(N, M).shuffle())
from tcgen import *
N = Integer()
print(N)
print(StrictlyIncreasing(N).shuffle())

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

cp-tcgen-0.11.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

cp_tcgen-0.11-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file cp-tcgen-0.11.tar.gz.

File metadata

  • Download URL: cp-tcgen-0.11.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for cp-tcgen-0.11.tar.gz
Algorithm Hash digest
SHA256 816cf2bdbde264b8aa101a1e5a0549bb509aeee5badb2327064b66a27f441292
MD5 6b7a437ac8bd267fab78ca9776beb01b
BLAKE2b-256 95db52f465981f036258f4042d1eabc730b10e858f31273dc0c10ed736f682a0

See more details on using hashes here.

File details

Details for the file cp_tcgen-0.11-py3-none-any.whl.

File metadata

  • Download URL: cp_tcgen-0.11-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for cp_tcgen-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 0e8eab2baa181576730764b1e2986c1045f063a2215f971b87c33f82832a072c
MD5 62e5e55594d67ab32bb201c6a1d1c894
BLAKE2b-256 33513124bfde845dfe4e7a8679c535ae04a3c0a6583bb392401320d1bb8fcd4a

See more details on using hashes here.

Supported by

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