A test suite for the whole arithm module which is intended to be used in coordination with a python script. More...
Go to the source code of this file.
Macros | |
#define | PATH_TO_INPUT_FILE "./input.txt" |
#define | PATH_TO_OUTPUT_FILE "./actual_output.txt" |
#define | STATISTICAL_ERROR 100 |
#define | N_RAND_ARRAYS 3 |
Functions | |
void | test_ModPGrp_toByteTree (std::ifstream &input, std::ofstream &output) |
Tests the byteTree related functions of the ModPGrp. | |
void | test_ModPGrp_exponentiation (std::ifstream &input, std::ofstream &output) |
Tests the modular exponentiation as implemented in ModPGrp (i.e. in ModField). | |
void | test_ModPGrp_multiplication (std::ifstream &input, std::ofstream &output) |
Tests the multiplication as implemented in ModPGrp (i.e. in ModField). | |
void | test_ModPGrp_getRandArray (std::ifstream &input, std::ofstream &output) |
Tests the derivation of random elements as implemented in ModPGrp. | |
void | test_ModPGrp_product (std::ifstream &input, std::ofstream &output) |
Tests the product of within an array of Elmts as implemented in ModPGrp (i.e. in ModField). | |
void | test_ModPGrp_expProduct (std::ifstream &input, std::ofstream &output) |
Tests the product of ModPGrpElmts as implemented in ArrayOfModPGrpElmts. | |
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 arithm 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 to compare its behaviour with that of the reference implementation. 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 arithmtest.cpp.
#define N_RAND_ARRAYS 3 |
Definition at line 42 of file arithmtest.cpp.
#define PATH_TO_INPUT_FILE "./input.txt" |
Definition at line 39 of file arithmtest.cpp.
#define PATH_TO_OUTPUT_FILE "./actual_output.txt" |
Definition at line 40 of file arithmtest.cpp.
#define STATISTICAL_ERROR 100 |
Definition at line 41 of file arithmtest.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 255 of file arithmtest.cpp.
void printHelp | ( | ) |
Prints the help of this program, including a list of the functions that can be tested.
Definition at line 238 of file arithmtest.cpp.
void test_ModPGrp_exponentiation | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Tests the modular exponentiation as implemented in ModPGrp (i.e. in ModField).
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 78 of file arithmtest.cpp.
void test_ModPGrp_expProduct | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Tests the product of ModPGrpElmts as implemented in ArrayOfModPGrpElmts.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 211 of file arithmtest.cpp.
void test_ModPGrp_getRandArray | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Tests the derivation of random elements as implemented in ModPGrp.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 142 of file arithmtest.cpp.
void test_ModPGrp_multiplication | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Tests the multiplication as implemented in ModPGrp (i.e. in ModField).
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 111 of file arithmtest.cpp.
void test_ModPGrp_product | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Tests the product of within an array of Elmts as implemented in ModPGrp (i.e. in ModField).
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 185 of file arithmtest.cpp.
void test_ModPGrp_toByteTree | ( | std::ifstream & | input, |
std::ofstream & | output | ||
) |
Tests the byteTree related functions of the ModPGrp.
Reads a bytetree from the input file, parses into a ModPGrp and then turns it again into a bytetree. This last bytetree is printed on the output file. This procedure is carried on each line of the input file, until the end of file is reached.
input | The input file at PATH_TO_INPUT_FILE (read). |
output | The output file at PATH_TO_OUTPUT_FILE (write). |
Definition at line 56 of file arithmtest.cpp.