Giter VIP home page Giter VIP logo

special-waffle's Introduction

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

special-waffle's People

Contributors

3centroids avatar mzums avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.