Welcome to the AMPL Testing Scripts repository! This repository contains a set of testing scripts designed to ensure the quality and functionality of the AMPL compiler. Please note that while we strive to maintain accurate tests, the validity of these tests is not guaranteed.
This repository houses a collection of testing scripts tailored to the AMPL compiler. By following the setup and usage guidelines outlined below, you can seamlessly run tests, check coding style, and even automate code formatting.
Before proceeding, ensure your system meets the following requirements:
You can install these dependencies using the following command:
sudo apt install gcc make python3 python3-pip
Additionally, install the required Python packages by running:
python3 -m pip install -r requirements.txt
To best utilize these testing scripts, adhere to the following directory structure:
ampl/
src/
test{module}.c
{requirements}.c
{requirements}.h
Makefile
test/
test.py
tests/
0.ampl
...
{module}/
0.out
...
bin/
test{module}
For optimal integration, we recommend cloning this repository directly into your existing ampl/
directory where your AMPL compiler is located. By doing so, you will be able to effortlessly keep your test suite up-to-date with the latest advancements through a simple git pull
command.
Here's how you can set it up:
-
Initial Setup: Open your terminal and navigate to the root directory of your AMPL compiler (
ampl/
). Then, execute the following commands:cd ampl git clone https://github.com/DylanKirbs/ampl-tests test
This will clone the repository and create a
test
directory within your AMPL directory. -
Keeping Up-to-Date: As new versions of the test suite are released, you can effortlessly update your local copy by using the following commands:
cd ampl/test git pull
Running these commands while inside the
test
directory will pull the latest changes from the repository.
Please note, when performing actions related to your AMPL version control, remember to operate from the ampl/
directory rather than the test/
directory to ensure smooth integration.
By adhering to this approach, you can seamlessly maintain and utilize the latest test suite advancements while working with your AMPL compiler.
All test scripts should be executed from the test/
directory.
Execute the test.py
script to initiate tests. To explore available options, run:
python3 test.py --help
For example, to run scanner tests:
# Run scanner tests 0 through 30
python3 test.py --scanner 0..30
# Run scanner tests 5 8 19 and 27
python3 test.py --scanner 5 8 19 27
To maintain consistent coding style, you can utilize two style checking scripts: styletest.py
and style_checker.py
. For the latest and more comprehensive checks, use style_checker.py
. Both scripts can be run as follows:
python3 styletest.py
python3 style_checker.py
For code auto-formatting using clang-format
, follow these steps:
- Install Clang-Format version 16 and add it to your PATH:
python3 -m pip install clang-format==16.0.6 && echo 'export PATH="$PATH'":$(python3 -m site --user-base)/bin\"" >> ~/.bashrc
source ~/.bashrc
- Copy the
.clang-format
file to the root of the project.
cp .clang-format ..
- Format your code using:
clang-format -i src/*
Note: Be cautious, as auto-formatting may alter your code style. Always review changes using git diff
before committing.
If you're contributing to the test suite, utilize the create_test_cases.sh
script. This script saves executed code to the module directory, effectively overwriting the "expected out."
We welcome contributions to this project! To get started, fork the repository, create a meaningful branch, and submit a pull request. Please avoid committing directly to the master
branch.
Name | Student Number |
---|---|
Dylan Kirby | 25853805 |
Zander Von Ludwig | 25870963 |
Michael van Zyl | 22604731 |
Matthew Stein | 25400800 |
Louis Wilkinson | 25948873 |
Luke Leppan | 25849611 |
Your contributions make this project possible!