Skip to content

Tempest989/42_Push_Swap_Tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42_Push_Swap_Tester

A Tester for the 42 push_swap Project

Purpose:

  • To provide a means of conducting randomized tests for any number of integers arguments.
  • Provide an evaluation tester that will conduct the tests that should be done in an evaluation to test for all possible errors and conduct speed tests for 3, 5, 100 and 500 integer arguments.

Which File to Run:

Both slow.sh and fast.sh files can be used to run this Tester, with the only major difference being fast.sh should be slightly faster than the slow.sh

  • If your OS can use the bash timeout and xargs -a functions, then run fast.sh file.
  • Otherwise run the slow.sh file, which uses different methods to replicate the uses of timeout and xargs -a.

How to Run:

  • For this section, run.sh will represent how you can use both slow.sh and fast.sh, so just replace run.sh with either file name to execute them.
  1. Change the path_locale variable in the run.sh file to point to the push_swap directory being tested, making sure the path_locale variable has a / character at the end.
  2. Change the bonus variable in the run.sh file to 1 if the Bonus is being tested, 0 if Bonus is not being tested.
  3. Change the system variable in the run.sh file to either linux or mac, depending on what OS the test is being run on, so the correct 42 checker can be used.
  4. The Tester can be Ran in Terminal by:
    • bash run.sh will run all tests that should be conducted in an evaluation.
    • bash run.sh * will run 100 tests for * integer arguments, like bash run.sh 10 will run 100 tests for 10 integer arguments. Making * equal to 1, 2, 3 or 5 will run the corresponding evaluation test for that number of integer arguments.
  5. After the Tester has finished running, the extra files created by run.sh can be deleted by running bash clean.sh in Terminal.

Checking Outputs and Inputs on Errors or otherwise:

The inputs / outputs during each test are stored in multiple, seperate files, so when an error occurs, checking these files will show the situation that occured. These Files will be Generated whilst running the Tester.

The Output files are:

  • output.txt: Contains the output printed to stdout by the tested push_swap executable.
  • error.txt: Contains the output printed to strerr by the tested push_swap executable.
  • check.txt: Contains the output printed to stdout by the checker_mac / checker_linux executable, given by 42.
  • check_error.txt: Contains the output printed to stderr by the checker_mac / checker_linux executable, given by 42.
  • bonus.txt: Contains the output printed to stdout by the tested checker executable, for the bonus of push_swap.
  • bonus_error.txt: Contains the output printed to stderr by the tested checker executable, for the bonus of push_swap.

The Input can be found:

  • Printed to terminal.
  • Or found in the *.txt where * stands for the current number of integer arguments being tested (for example, 100 argument test input can be found in 100.txt)

Uses for Each File:

  • checker_linux and checker_mac are the given 42 checker executables for the push_swap project at the time of updating this repository. Feel free to replace them with up-to-date versions once you clone this directory.
  • fast.sh and slow.sh are the testing scripts where all the tests are executed.
  • random.c is the RNG Generation script which is used by fast.sh and slow.sh.
  • clean.sh can clean up all the extra files generated by fast.sh and slow.sh, just for convenience.
  • Combinations_of_5.txt contains all possible combinations for 5 integer numbers.

Credits:

  • Got the main RNG Generator function from the 1st Stack Overflow answer here
  • Got Pearl script which replicates timeout function for the slow.sh file from the 2nd Stack Overflow answer here

About

A Tester for the 42 push_swap Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published