A test suite for the whole ByteTree module which is intended to be used in coordination with a python script. More...
#include <gmp.h>
#include <gmpxx.h>
#include <fstream>
#include <cstring>
#include "verifierutils.hpp"
Go to the source code of this file.
Macros | |
#define | PATH_TO_INPUT_FILE "./input.txt" |
#define | PATH_TO_OUTPUT_FILE "./actual_output.txt" |
Functions | |
void | test_ByteTree_parseString (std::ifstream &input, std::ofstream &output) |
Reads hexadecimal string representation of ByteTrees from input.txt and outputs the same representation on actual_output.txt. | |
void | test_ByteTree_parseFile (std::ifstream &input, std::ofstream &output) |
Reads in input.txt the path to a file containing a bytetree, parses it and outputs the content of it on actual_output.txt. | |
void | test_Leaf_toInteger (std::ifstream &input, std::ofstream &output) |
Reads decimal representations of large integers, constructs Leaf's instances from them and then turns them into integers again. | |
void | test_Leaf_toBoolArray (std::ifstream &input, std::ofstream &output) |
Reads the decimal representations of large integers, constructs Leaf's instances from them and then turns them into boolean arrays. | |
void | printHelp () |
Prints the help of this program, including a list of the functions that can be tested. | |
int | main (int argc, char **argv) |
A test suite for the whole ByteTree module which is intended to be used in coordination with a python script.
It is meant to be used in coordination with the unitarytest.py python script so as to compare its behaviour with that of the reference implmentation. The functions in this file are sort of interfaces between the actual classes tested and the unitary tests provided by the python script and based on the reference implementation (which is in python). This script produces a test vector, "./input.txt", and a file containing what this program should output, "./ideal_out.txt".
For each non-virtual function in this module, there is a unitary test reading its data line by line. It reads one line of the "./input.txt" file, processes it, writes one line in "./actual_out.txt" and continues until the end of the input file is found.
In the end, the differences between "ideal_out.txt" and "actual_out.txt" are computed. If there is even one error, then you have a problem.
Definition in file btrtest.cpp.
#define PATH_TO_INPUT_FILE "./input.txt" |
Definition at line 38 of file btrtest.cpp.
#define PATH_TO_OUTPUT_FILE "./actual_output.txt" |
Definition at line 39 of file btrtest.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 163 of file btrtest.cpp.
void printHelp | ( | ) |
Prints the help of this program, including a list of the functions that can be tested.
Definition at line 147 of file btrtest.cpp.
void test_ByteTree_parseFile | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Reads in input.txt the path to a file containing a bytetree, parses it and outputs the content of it on actual_output.txt.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 69 of file btrtest.cpp.
void test_ByteTree_parseString | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Reads hexadecimal string representation of ByteTrees from input.txt and outputs the same representation on actual_output.txt.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 49 of file btrtest.cpp.
void test_Leaf_toBoolArray | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Reads the decimal representations of large integers, constructs Leaf's instances from them and then turns them into boolean arrays.
Integers are read from input.txt and boolean arrays are output in actual_output.txt.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 115 of file btrtest.cpp.
void test_Leaf_toInteger | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Reads decimal representations of large integers, constructs Leaf's instances from them and then turns them into integers again.
Integers are read from input.txt and output in actual_output.txt.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 91 of file btrtest.cpp.