Git Product home page Git Product logo

ampl-tests's Introduction

AMPL Testing Scripts

Header Image

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.

Overview

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.

Setup

Requirements

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

Repository Structure

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}

Seamless Integration and Updates

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:

  1. 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.

  2. 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.

Usage

All test scripts should be executed from the test/ directory.

Running Tests

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

Style Checking

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

Auto-Formatting with clang-format

For code auto-formatting using clang-format, follow these steps:

  1. 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
  1. Copy the .clang-format file to the root of the project.
cp .clang-format ..
  1. 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.

Creating Tests for a Module

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."

Contributing

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.

Acknowledgments

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!

ampl-tests's People

Contributors

dylankirbs avatar lukeleppan avatar zofficial07 avatar

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.