GithubHelp home page GithubHelp logo

batch-tester's Introduction

Batch Tester

If you're like me, you do a lot of programming competitions. If you don't want a bunch of incorrect submissions, these require some method of testing your code before you submit it. While you could test cases by hand, using a script to batch-test is a much smarter method.

Usage

I suggest you clone this project to use it, and use pulls later to update.

Config

Before you use the script, you'll need to setup a config.json file. Here's what that would look like:

{
	"languages": {
		"Java 8": { // the name of the language
			"aliases": ["java", "j8"], // how you'll access the language
			"template": "templates/template.java", // template file; see below
			"file": "%s.java", // what the file should be called
			"compile": "javac %s -d %s", // the compile statement (if applicable)
			"run": "java %s" // the run statement
		},
		"Python 3": {
			"aliases": ["python", "py"],
			"template": "templates/template.py",
			"file": "%s.py",
			"run": "python3 %s"
		}
	},
	"directories": {
		"root": "/Programming/Competitions", // path to root directory for contests
		"contest": "%s", // what to name a contest directory
		"src": "src", // what to name a source directory
		"bin": "bin" // what to name a binary directory
	},
	"defaults": {
		"compile_timeout": 15 // how long to wait for compilation
	}
}

Templates

You can also include templates for your source files. To use them, set a "template" property on the language object in the config file with the path to your template relative to the script itself (or just use an absolute path).

Install Packages

Some pip packages are required to run the testing script. To install them, use

pip install -r requirements.txt

Usage

To start the script, use

python tester.py

Please note that only python 3.x is supported at the moment.

Once the script is started, you will be prompted to enter a contest name. This name will correspond to the directory in which all of the contest files are stored. (I personally recommend something like 315D1 for Codeforces #315, Division 1, for example, but it's really up to you.)

After you've entered a contest name, you're presented with a command line. You can type "help" for a full list of commands from there, or I have listed them below:

  • add problem lang - Creates new problem files for the given problem in the given language. This will add three files: the source file itself, a test cases input file, and a test cases output file.

  • test problem lang - Tests a solution using the test cases in the test cases input file and checking against the answers in the test cases output file.

batch-tester's People

Contributors

bluepichu avatar

Stargazers

 avatar

Watchers

 avatar  avatar

batch-tester's Issues

Add File I/O Option

ACM often uses file I/O, so including that as an option would definitely be nice.

Add Submit Function

This would be REALLY GOOD.

Probably would require a URL to which to submit. This could be stored in problem descriptors (see #4).

Add wildcard of some kind

It's often helpful to put in TLE-testing cases without actually knowing the correct answer. There should be a way to do this without it getting marked WA.

Add memory usage

It was here at one time, but I will say that it was really wonky before. Python seems to have several ways of handling this, but none of them seem to be exactly what's needed here.

Add warnings

For example, half TL or half ML would be reasonable cases in which to alert the user.

Problem Descriptor

Adding problem descriptors would be a good feature, since then there would be easy storage of problem information (I/O style, grading type, etc). Could also be helpful for #3.

Fix Timing

The timer always shows up as 1-2ms... even on TLEs of >3s.

Improve graders

For example, adding all of the standard CF checkers is a reasonable step to take.

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.