A Tester for the 42 push_swap Project
- 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.
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.
- For this section,
run.sh
will represent how you can use bothslow.sh
andfast.sh
, so just replacerun.sh
with either file name to execute them.
- 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. - Change the bonus variable in the
run.sh
file to 1 if the Bonus is being tested, 0 if Bonus is not being tested. - 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. - 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, likebash 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.
- After the Tester has finished running, the extra files created by
run.sh
can be deleted by runningbash clean.sh
in Terminal.
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 testedpush_swap
executable.error.txt
: Contains the output printed to strerr by the testedpush_swap
executable.check.txt
: Contains the output printed to stdout by thechecker_mac
/checker_linux
executable, given by 42.check_error.txt
: Contains the output printed to stderr by thechecker_mac
/checker_linux
executable, given by 42.bonus.txt
: Contains the output printed to stdout by the testedchecker
executable, for the bonus of push_swap.bonus_error.txt
: Contains the output printed to stderr by the testedchecker
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)
checker_linux
andchecker_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
andslow.sh
are the testing scripts where all the tests are executed.random.c
is the RNG Generation script which is used byfast.sh
andslow.sh
.clean.sh
can clean up all the extra files generated byfast.sh
andslow.sh
, just for convenience.Combinations_of_5.txt
contains all possible combinations for 5 integer numbers.