Giter Site home page Giter Site logo

test_program's Introduction

TestProgram

TestProgram is a specific purpose testing tool for competitive programming programs, i.e. Codeforces, lightOJ, OmegaUp, etc.

When we solve a problem we have to very careful and aim to tackle every possible case. The more test cases our solution solves correctly before summiting the better.

You can always do something like:

#ifndef ONLINE_JUDGE
   freopen("input.txt", "rt", stdin);
   freopen("output.txt", "wt", stdout);
#endif

Or (my former strategy):

$ ./mysolution < input.txt > output.txt

However, if you have more than one test case, this soon becomes a hassle, error prone, time consuming and other problems related to manual testing.

I've developed TestProgram for help automate test case management and the execution of them. For now the supported languages are C++, Java, Python and Ruby, however it's easy to add support for other languages.

NOTE: For each language, TestProgram assumes that you have the corresponding compilers or interpreters installed.

TestProgram runs in GNU/Linux but it's also possible to run it on windows using Cygwin. I haven't tested it on Mac OS but I think it should run well without major complications.

#Usage For the impatients here you have two demos in video, the first one describes the general use and the second shows how to use it with Codeforces.

TestProgram work by mean of commands and each command has actions. These are the available commands:

  • init Setups a contest environment.
  • test Create, show, edit and delete test cases.
  • gen Generate solution template.
  • clean Remove any test related file.

###tp init Setups a programming contest environment in the current working directory.

usage: tp init <contest> [template]

Where contest is a key of a supported programming contest, e.g. codeforces. With [template] you can also indicate which programming language you want for the solution templates passing the file extension of a supported language. See the following list:

cpp     =>  C++
java    =>  Java
rb      =>  Ruby
py      =>  Python

###tp test Manage the test cases for a particular problem.

Available actions:

  • add Creates a new test case manually.
  • rm Deletes a specific test case.
  • edit Edit a specific test case.
  • show Shows the contents of a specific test case.
  • run Executes a particular test case. If no test case is specified all test cases will be executed.

Each test case is identified by an integer, all actions, with exception of add, need this identifier to proceed.

###tp gen Generates a solution template for a supported language.

usage: tp gen <file.lang>

Where lang corresponds to the programming language extension, these are the extensions for the supported languages:

cpp     =>  C++
java    =>  Java
rb      =>  Ruby
py      =>  Python

###tp clean Remove all file generated by this tool.

Available options:

-r  Find and deletes generated files recursively.

#Know bugs

  • When downloading test cases from codeforces tp creates testing files for five problems (A to E).

#Limitations

  • Only literal comparisons of the output, floating point comparisons and solution checkers are coming soon.

#Requirements TestProgram depends on the following programs:

  • Bash
  • Diff
  • Vim (not optional by the moment)
  • timeout
  • GCC, Java, Python and/or Ruby depending on what programming language do you use.

#Bug reports and contributions If you find a bug please create an issue, or even better, fix it and create a Pull Request.

All contributions are welcome!

#License This project is under GPLv3, with exception of cf-parser which is an adaptation of Codeforces Parser, which I think is also a free software license: http://codeforces.com/blog/entry/10416#comment-175092.

test_program's People

Contributors

rendon avatar

Stargazers

Helbert Moreira Pinto avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

atulshgl

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.