Skip to content

A Python implementation of the well-known shunting-yard algorithm for students to unit test.

Notifications You must be signed in to change notification settings

Autumn2018-CSCI391-SoftwareTesting/Basic-Unit-Test-Suite

 
 

Repository files navigation

Shunting-yard Algorithm

This repository contains a simple Python 3 module that implements the well-known shunting-yard algorithm. This algorithm allows the conversion of a mathematical expression written using the familiar infix notation into an equivalent expression written in postfix notation. You can find out more about this algorithm from the sources below.

The module, found in shunting_yard.py contains a function called infixToPostfix, which implements the basic algorithm, along with a number of helper functions. I suggest testing each helper function in isolation since they are written so as not to depend upon one another.

I have included a script called demo.sh that provides several small manual functional test cases and demonstrates how to run the module as a command line program. This is purely for those who may be interested (and for my own testing). You don't need to worry about functional testing and you shouldn't make any changes to the module code.

Evaluation

I will execute the script called runtests.sh to run your unit tests. I have populated this file with a command that should be sufficient. However, if you find that you'd like me to run your tests using a different command, simply modify the script accordingly.

Run the script like this: ./runtests.sh.

By default, any files that match the pattern test*.py where * is a wildcard meaning "anything", will be searched for tests. I have added a single test for the tokenize function as an example to get you started.

I will make several modifications to the module code to introduce bugs in different functions. Your tests should "catch" these bugs. In other words, if I add a bug in a given function, one or more of your tests for that function should fail when I run the tests afterward.

About

A Python implementation of the well-known shunting-yard algorithm for students to unit test.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.1%
  • Shell 2.9%