cpast_cli - Code Testing and Analysis Tool
Introduction
[!WARNING] Builds are currently broken for android mobiles as we recently removed clipboard support feature! We are thinking more for the fix along the way
cpast_cli(from now on cpast) is a game-changing CLI tool designed specifically for competitive programmers and developers who want to enhance their coding efficiency. Written in Rust for speed and reliability, cpast simplifies the process of comparing outputs from different code files, allowing you to focus on solving problems effectively.
Installation
To get started with cpast, you need to install it. You can do this by running the following command:
Required for clipboard support!
Chances are that clipboard support might be broken for some WMs like bspwm, but other features will work just fine!
We have first class support for macOS, Linux (GNOME, KDE, Hyprland) and Windows
Usage
Here's a simple example of how to use cpast:
test
correct.cppshould contain the correct code.incorrect.cppshould contain the incorrect code.(N) (?:N){\1}is the language generator.100is the number of test iterations.
cpast test --debug ... can be used to debug the test cases generated.
generate
- Generates string of length 10, of uppercase characters only
ai
GOOGLE_API_KEY="<gemini-api-key>"
-
Generates clex using LLM from input format and constraints.
-
Get API key from https://makersuite.google.com/app/apikey
-
Alternatively, expose the API key from the shell configuration file like bashrc, zshrc etc using:
;
Shell Completions
To generate shell completions for cpast, use the following commands based on your shell:
-
zsh:
| -
fish:
cpast --completions=fish > ~/.local/share/fish/generated_completions/cpast.fish -
bash:
|
Language Specification
At the heart of cpast is clex_gen, a powerful custom language generator that gives you complete control over input patterns. Imagine regex, but specifically designed for generating random test cases. With clex, you can easily define and automate complex input scenarios to stress-test your code, uncover hidden bugs, and identify edge cases that might otherwise go unnoticed.
For more information on the clex language and its usage, please refer to the Grammar Rules for Clex Generator.
Backslash Plague in CLI
When using cpast in the CLI, you'll need to properly escape special characters in clex expressions, particularly backslashes in repetition patterns. For example:
# Incorrect usage
# Correct usage with escaped backslash