To generate a test case write the representation of an input token list into a .txt file, with the following guidelines for each file:
1
2
-2
-3
Generated tests should go in the tests
directory.
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
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:
YOURLABFILE
and TESTFILE
are both in the same current directory 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: