cpast - Code Testing and Analysis Tool
cpast is a versatile code testing and analysis tool that allows you to test correct and incorrect code files against a custom language generator called clex. It supports a variety of programming languages, including Python, C++, C, Rust, Ruby, JavaScript, and Java. You can specify the number of iterations and test your code against random input values, comparing the output against expected results.
Introduction
cpast - Code Testing and Analysis Tool is your solution to a crucial problem faced by competitive programmers (CP) and coding enthusiasts. It empowers you to streamline your coding journey and overcome common challenges in competitive programming and coding practice.
Checkout the blog post here
Addressing a Crucial Problem in Competitive Programming (C.P.)
Competitive programming, often referred to as C.P., involves solving algorithmic and coding challenges within strict time limits. Participants in coding contests, such as ACM ICPC, Codeforces, and LeetCode, often face challenges like:
- Verifying code correctness against various test cases.
- Efficiently testing code under time constraints.
- Debugging errors quickly to improve code performance.
cpast has been designed to tackle these challenges head-on and make the competitive programming experience more efficient and enjoyable.
How cpast Solves the Problem
1. Testing Correctness
cpast enables you to test your code with both correct and incorrect code files, ensuring that your solutions work as expected while also helping you identify and fix issues in your code.
2. Rapid Testing
In competitive programming, time is of the essence. cpast allows you to define custom test cases and automate testing, saving valuable time that would otherwise be spent manually verifying code correctness.
3. Debugging Support
With cpast, you can quickly identify and debug issues in your code by comparing actual output with expected results. This helps you fine-tune your code for optimal performance.
By addressing these crucial problems, cpast enhances your competitive programming experience, making it more efficient and effective, ultimately improving your coding skills and competition performance. Say goodbye to manual testing and debugging, and let cpast handle the heavy lifting for you.
Table of Contents
Features
- Test correct and incorrect code files.
- Set the number of iterations to run your tests.
- Support for multiple programming languages.
- What's new?
Getting Started
https://github.com/rootCircle/cpast/assets/35325046/e8f28d06-eba4-4f00-8afc-240dcf7c56f3
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!
Default compilations won't be supported due to lack of clipboard API support in those systems, and hence you need to compile it with --no-default-features feature
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.
generate
- Generates string of length 10, of uppercase characters only
Language Specification
The clex language generator is based on a custom grammar specification. It allows you to define input patterns for testing.
For more information on the clex language and its usage, please refer to the Grammar Rules for Clex Generator.
Roadmap
- Support for Capturing Group inside Non-capturing group
- Support strong strings checks like all lowercase, uppercase, alphabets, numbers, alphanumeric
- Allow only one time compilations in future
- Add docs about
clexusage. For now try inferring from TEST_LANGUAGE.md file. - Floating Limit support in Range Bounds for Numeral Data Type for Float
- Support Back-references in Range Bounds as well.
Now you are ready to use cpast for testing your code against various programming languages and input patterns defined by the clex language. Happy testing!