Giter Club home page Giter Club logo

check.py's Introduction

About
=====

check.py is a library and base script for checking programs against testcases. It was developed by Max Whitney (mwhitney at cs.sfu.ca) and Anoop Sarkar (anoop at cs.sfu.ca) for the latter's CMPT 413 and CMPT 379 courses at the School of Computing Science, Simon Fraser University.

Description
===========

Concrete test programs extend check.py by specifying checks on testcase groups. Each group named GROUP corresponds to a directory TESTCASE-DIR/GROUPNAME containing testcase files. See below for the format of testcases. Each group uses some source files in the answer directory which will be executed with some command, with inputs and expected outputs from the testcases.

In the default setup each group has a single source file which is the group name plus a .py suffix. It is executed with the same python interpreter used to run the check program.

All checks are run with ANSWER-DIR as the current directory. If a program being checked succeeds then it should exit with zero status (sys.exit(0) or reaching the end of the program). If it fails (eg due to invalid input) then it should exit with non-zero status (eg sys.exit(1)). Testcases with a TC.fail file (see below) are expected to fail.

Testcases
=========

Each TESTCASE-DIR/GROUP/TC directory contains the following types of files. Here TC is the name of a testcase in group GROUP.

TC.file : contains filename used as standard input (stdin) to the command for
          GROUP
TC.in   : input sent to standard input (stdin) to the command
          TC.file and TC.in should not simultaneously exist.
TC.cmd  : the command line argument to the command, parsed as if on the shell
TC.out  : expected output printed by program.py to standard output (stdout)
TC.err  : expected output printed by program.py to standard error (stderr)
TC.fail : indicates that program.py should fail

For example, if the command for group foo is "python foo.py" and we have
    foo/bar.in: 123
    foo/bar.cmd: -n 10 -t "a b c"
    foo/bar.out: 321
then testcase bar in group foo will be executed as in the following shell command:
    python foo.py -n 10 -t "a b c" < foo.py
Its standard output will be checked against the string "321".

API
===

Until this section is written properly, please see the examples in the tests/ directory. They show how to set up a variety of testcases and checks.

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.