UCSD CSE100 Fall 2016 PA3 Self-Tester for Students.
WARNING: THIS SCRIPT IS PROVIDED WITHOUT ANY GUARANTEE. IT IS YOUR RESPONSIBILITY TO MAKE SURE YOUR CODE WORKS CORRECTLY.
Before you use it, please read the script and make sure you understand what it is doing. I have written many comments so that the script is more understandable.
Being able to write these scripts is a skill that we expect you to develop and will make you a much stronger programmer.
The tester assumes you have the following PA directory sturcture:
.
|-- BitInputStream.cpp
|-- BitInputStream.hpp
|-- BitOutputStream.cpp
|-- BitOutputStream.hpp
|-- HCNode.cpp
|-- HCNode.hpp
|-- HCTree.cpp
|-- HCTree.hpp
|-- Makefile
|-- compress.cpp
|-- ty_tester.sh
|-- pa3_input_files
| `-- (the input files used for testing)
|-- refcompress
|-- refuncompress
`-- uncompress.cpp
- The tester use
make
to compile your code;
- The tester will exit if
make
fails.
- It generates a random binary input file and a random text input file for testing using
openssl rand
;
- The two files will be 5 MiB in size to keep the running time reasonable;
- The tester will loop through all the input files found in
pa3_input_files
to test them;
- Accuracy Test: For each file, the tester will perform a
compress
anduncompress
and compare the result with the original file;- The tester will exit if an accuracy test fails.
- Compression Ratio Test: If you pass in
-r
flag, the tester will also perform arefcompress
and compare the sizes of compressed versions to make sure your version beats the reference version in compression ratio.- The tester will continue even if a compression ratio test fails.
- Temporary files generated by the tester will be deleted upon exit.
- Download the script and place it in the correct location (see above).
- Read the script and make sure you understand what it is doing. Being able to write these scripts is a skill that we expect you to develop and will make you a much stronger programmer.
- Usage information is described in detail inside the script.
Good luck on this PA!
This was originally written and used by me a few quarters ago. I made some changes that are inspired by Raymond's script from the Winter 2016 quarter.