Generation of Test Cases for the Lab RPN Calculator

To generate a test case write the representation of an input token list into a .txt file, with the following guidelines for each file:

For example the valid postfix ordered test case from the infix notation “1 - 2” would be:
1
2
-2
-3

Generated tests should go in the tests directory.

Obtaining files and Execution Permission

The files needed for these instructions are in the Code folder in the git repo that you should clone from GitHub Classroom to start this lab.

For the next steps, you need to ensure that the shell scripts (compileTests.sh and runTest.sh) has permission for execution so that it can run as a program. To see the permissions that all your files have you can run the command:
ls -l

An r indicates read permission, a w indicates write permission, and an x indicates execution permission.

To add execution permission to the file runTest.sh you need to execute this command:
chmod u+x [script.sh]

Once you have generated the .txt files, to generate the input token list files (.bin files that are required by the common.s file), run the following script:
./compileTests.sh

To compile a single .txt file to .bin format use:
python3 convert.py tests/TESTFILE.txt

Running Your Program

Place your code in a file named calculator.s, where the first label under the .text directive must be calculator, and save it under the current directory.

To generate the output of your program for a test case use the following script:
./runTest.sh YOURLABFILE TESTFILE

Note: The TESTFILE is the .bin file not the .txt file.

You have two options for the location of your files:

  1. You can ensure that both YOURLABFILE and TESTFILE are both in the same current directory
  2. You can specify the path to these files. For instance, if your TESTFILE is in the tests subdirectory, you would be running the command:
    ./runTest.sh YOURLABFILE tests/TESTFILE

The following files are provided in the Code folder:


Last modified: Fri Aug 13 05:41:33 MDT 2021