Giter Site home page Giter Site logo

michellejiam / lazyphilosopherstester Goto Github PK

View Code? Open in Web Editor NEW
53.0 1.0 6.0 16 KB

A semi-automatic tester for checking 42's philosophers project. It tests: invalid inputs, when program should stop on death/eaten enough, and when program should stay running (timed).

Python 16.56% Shell 83.44%
42 philosophers testing-tools

lazyphilosopherstester's Introduction

Lazy Philosophers Tester

A semi-automatic tester for checking 42's philosophers project (2021 curriculum).
It allows you to test 2 scenarios:

  1. when your program should stop, either due to death, enough eaten, or bad input
    • to be checked manually by the user, based on the expected result listed in yes-die.txt.
  2. when no philosophers should die
    • this is checked automatically if the program runs for x seconds (default 10) without death.

More tests can be added by editing the appropriate .txt files with the input and expected outcome.

screenshot of tester being run

Installation

Clone the tester into the root directory of your philosophers project.

https://github.com/MichelleJiam/LazyPhilosophersTester.git

Usage

If you haven't already, run make in your philo directory to create your ./philo executable.
Then from within the LazyPhilosophersTester directory, run ./test.sh to start the tester.
Tester takes an optional 2nd argument of the path to your philo executable.

Example:

./test.sh ../philo

If not provided, the tester assumes the path is ../philo - i.e. in same directory as tester directory.

Adding tests

If you wish to add your own tests, open either:

  1. no-die.txt for tests where philos aren't supposed to die, or
  2. yes-die.txt for tests where the program should stop (death, eaten enough, error).

The 1st line should be your test case, separated by spaces. This is what is inputted into your program.
The 2nd line should be the expected outcome. This is outputted during the tester for checking purposes.

Example:

4 310 200 100
a philo should die
5 800 200 200 7
no one should die, simulation should stop after 7 eats

Credits

Timed-checker Python script PhilosophersChecker.py (link) was written by JKCTech and modified slightly by me to take an optional timer duration.
Progress bar function written by Vagiz Duseev, found on StackOverflow.

lazyphilosopherstester's People

Contributors

joppiesaus avatar michellejiam avatar seozkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lazyphilosopherstester's Issues

Python script not working with bonus

Python timing script doesn't currently detect bonus program due to calling killall() on "philo" program.
Need to change to call it on bonus program if run from within bonus folder.

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.