Jethro Moller
12 April 2018
- Navigate to the project root directory
Containers. - Run
maketo build the executable,huffencodein thebuilddirectory. - Run
make run ARGS="<input_file> <output_file>"to runhuffencodewith the given input and output names.
NB: These files should be in theassetsdirectory, and the resulting output will be in theassetsdirectory. - Alternatively, the executable binary can be found in the bin folder and executed from the terminal using huffencode <input_file><output_file>, or bin/huffencode <input_file><output_file> from the root directory.
- Run
make cleanto delete any artifacts created when compiling & running the compression program.
- Navigate to the project root directory
Containers. - Run
make teststo build the executable,testin thebuild/Testsdirectory. - Run
make test-allto run thetests-nodeandtests-treeexecutables. - Run
make cleanto delete any artifacts created when running the tests.
- The parent node is initialised to a key value of char(-2) when no key value exists - this is to provide total control over the fields because if this value was not assigned then it would be up to the compiler to determine its value
- The EOF character is represented by as char(-1). This value is included in the code table so that when reading in the bit stream, during extraction, the program will know to stop reading in when it reads in the EOF character
- Compressed files will have a .hc extension
- Compressed bit streams will have no extension
- The <output_file>.hdr file makes use of JSON format to store the code table
- "lorem.txt" is the file I use for testing
- When converting to a bit stream, the "single int as header which lists the number of bits in the file" is stored as <file_name>.data
- The last test case passes an encoded string to the compressToBits method, then reads the resulting file with unpackBits and tests it against the original encoded string
- When the program is executed it will generate a file containing a string (.hc), a containing a bit stream, a file listing the number of bits in the bit stream (.data) and a JSON representaion of the code table (.hdr)
