Skip to main content

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())

Metadata

Release files for cp-tcgen 0.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cp-tcgen 0.11.1
File Size Uploaded Provenance
cp-tcgen-0.11.1.tar.gz 11.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cp-tcgen 0.11.1
File Interpreter ABI Platform
cp_tcgen-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / cp-tcgen-0.11.1.tar.gz

Download URL cp-tcgen-0.11.1.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc4693ab2c650c7b0a04d6a7215e9cd5909a5180fb5c6704abc0d65273cd883c
BLAKE2b-256 checksum
How to use checksums
79e1078b99629f6ab05be879d1ee5ba0cf98d7339cc298f692e7ba70313620df
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / cp_tcgen-0.11.1-py3-none-any.whl

Download URL cp_tcgen-0.11.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b69738282fe8622082a22a3310c9305a58b56a121866b8ba90b39c031cb35dc7
BLAKE2b-256 checksum
How to use checksums
17bfab3a703718454ec681e995e433a70b2b4ef1967e9ab133b43fbd83f776d1
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for cp-tcgen 0.11.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page