Yet Another Push Swap Tester is a tester for the Push Swap project. This tool automates the testing of your push_swap program by running a variety of test cases, including error handling, edge cases, and performance benchmarks. It also verifies the correctness of the output using the provided checker binaries.
The YAPST project is designed to simplify the testing process for the Push Swap program. It ensures that your program handles various scenarios correctly, including invalid inputs, edge cases, and large datasets. The tester also evaluates the performance of your program by counting the number of operations performed.
The tool checks for the presence of the push_swap, checker_OS, and optional checker binaries in the project directory. It uses these binaries to validate the output of your program.
- Error Handling Tests: Verifies how your program handles invalid inputs.
- Edge Case Tests: Tests scenarios like single elements, sorted inputs, and boundary values.
- Performance Benchmarks: Measures the number of operations for datasets of varying sizes.
- Randomized Tests: Generates random test cases for additional robustness.
- Bonus Checker Support: Optionally validates results using a bonus
checkerbinary.
- Python 3.6 or higher
push_swapandcheckerbinaries- A Unix-based system (Linux or macOS)
- Clone this repository into your
push_swapproject directory:git clone https://github.com/nerraf-dev/yapst.git
- Copy
test_push_swap.shinto yourpush_swapproject directory:cp -r yapst/test_push_swap.sh . - Ensure the push_swap and checker executables are in the same directory as test_push_swap.sh:
push_swap ├── Makefile ├── push_swap ├── checker ├── checker_OS ├── test_push_swap.sh ├── src │ └── push_swap .c files └── tester └── tester .py files - Make the script executable:
chmod +x test_push_swap.sh
- Run the script:
./test_push_swap.sh
- Run the script:
./test_push_swap.sh
- The script will automatically:
- Check for the presence of the required binaries (
push_swap,checker, andchecker_OS). - Run various test cases.
- Display results, including the number of operations and any errors.
- Check for the presence of the required binaries (
- To test specific scenarios, modify the test cases in the
tester/tests.pyfile
The tester includes the following categories of tests:
- Error Handling: Ensures invalid inputs are handled gracefully.
- Edge Cases: Tests scenarios like single elements, sorted inputs, and boundary values.
- Almost Sorted: Evaluates performance on nearly sorted datasets.
- Descending Order: Tests reverse-sorted inputs.
- Random Order: Generates random datasets for testing.
- Benchmarks: Measures performance on datasets of sizes 3, 5, 100, and 500.
Contributions are welcome! If you have ideas for new test cases or improvements, feel free to submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Ensure that the push_swap and checker binaries are compiled and functional before running the tester.
For bonus validation, include the checker binary in the project directory.