Skip to content

mzums/special-waffle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE In the following days this will get archived and rewritten in bash (Linux, macOS) and possibly batch (Windows).

local-test

Portable local testing software (and test case generator TODO: implement this) written in Python for competitive programming in C++.

Platform support

Unix-like (e.g. macOS, Linux) uses bash and Windows uses Command Prompt.

platform Unix-like Windows WSL2
support ✔️ ✔️
shell bash cmd bash

Usage

example folder structure

.
└── foo/
    ├── bar-tests/
    │   ├── 0.in
    │   └── 0.out
    └── bar.cpp

output generated with -h

usage: lt.py [-h] -p PROGRAM [-c]

optional arguments:
  -h, --help            show this help message and exit
  -p PROGRAM, --program PROGRAM
                        program pathname
  -c, --compile         compile program (default=False)

Unix-like

python3 $lt/lt.py -p bar.cpp -c
For simplicity, setup an environment variable for your local-test directory.

echo "export VARIABLE_NAME=value" >> ~/.bash_profile

Windows

python %lt%\lt.py -p bar.cpp -c
Unless local-test directory is an environment variable ("lt"), replace "%lt%\lt.py" with its pathname.

Environment Variables > System variables > New

Writing test cases

IMPORTANT Make sure to have matching newlines, otherwise correct output might flag your program as defective. Example below.

bar.cpp

#include <cstdio>
using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    printf("%d\n", n);
}

^ Newline character present

0.in

66

^ Would work without newline

0.out

66

^ Newline present

## Why Python?

SIO2 (used by POI (POI's SIO2 link)) itself is partially written in Python. Honestly, I found joy writing Python for a change. BTW check out similar testing program written in bash shell (link).

Configuration - config.json

WARNING Specified compiler will be run in shell.

Valid key options

(not actual JSON below)

"platform": ["Unix", "Windows"]
"compiler": ["clang++", "clang", "g++", "gcc", "etc."]
"generator-prefix": ["gen", "g", "etc."]

TODO

Known issues and future improvements

Contributing

Contribution guidelines for this project

About

local-test (AKA special-waffle)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%