19 if(strncmp(line,
"polynomial ", 11) != 0){
20 printf(
"Fatal, malformed input: Expected polynomial keyword\n");
25 if(line_read_size != expectedLineSize){
26 printf(
"Fatal, malformed input: Expected %ld input size, read %ld\n", expectedLineSize, line_read_size);
30 line += 11*
sizeof(char);
32 int testIdx=fftTest->
nTest;
38 for(
int i=0; i<4; i++){
39 strncpy(tmp, line, 16); tmp[16]=
'\0';
41 line+=16*
sizeof(char);
49 char tmp[17]; uint64_t val;
50 int testIdx = fftTest->
nTest;
51 line = memchr(line,
' ', 32)+
sizeof(char);
53 for(
int i=0; i<12; i++){
54 strncpy(tmp, line, 16); tmp[16]=
'\0';
55 val = strtoul(tmp, NULL, 16);
60 line+=16*
sizeof(char);
74 if(strncmp(line,
"fftTestInput", 12) != 0){
75 printf(
"Fatal, malformed input: Expected fftTestInput keyword\n");
85 if(strncmp(line,
"fftTestOutput", 13) != 0){
86 printf(
"Fatal, malformed input: Expected fftTestInput keyword\n");
97 if(strncmp(line,
"setup ", 6) != 0){
98 printf(
"Fatal, setup malformed >> %s", line);
101 line += 6*
sizeof(char);
104 for(
int i=0; i<4; i++){
105 strncpy(tmp, line, 16); tmp[16]=
'\0';
106 fftTest->
setup.
word[3-i] = strtoul(tmp, NULL, 16);
107 line+=16*
sizeof(char);
115 #define eprintf(fmt , ...) fprintf(stderr, fmt, ##__VA_ARGS__)
118 eprintf(
"Lenght of the polynomials: %d \n",
test.polynomialLength);
119 eprintf(
"Setup %016lx %016lx %016lx %016lx \n",
test.setup.word[0],
test.setup.word[1],
test.setup.word[2],
test.setup.word[3]);
122 for(
int i=0; i<
test.nTest; i++){
124 for(
int ii=0; ii<4; ii++){
126 for (
int j=0; j<6; j++)
eprintf(
"%016lx ",
test.testCase[i].fftInput[ii].word[j]);
eprintf(
"\n");
128 for (
int j=0; j<6; j++)
eprintf(
"%016lx ",
test.testCase[i].fftOutput[ii].word[j]);
eprintf(
"\n");
138 fp = fopen(filename,
"r");
140 printf(
"Error while trying to open file %s\n", filename);
144 size_t line_buff_size = 0;
146 ssize_t line_read_size = 0;
149 line_read_size = getline(&line, &line_buff_size, fp);
150 ntests = atoi(line+7*
sizeof(
char));
157 line_read_size = getline(&line, &line_buff_size, fp);
162 line_read_size = getline(&line, &line_buff_size, fp);
167 if(line_read_size < 0)
170 parsePoly(line, &fftTest, line_read_size);
172 line_read_size = getline(&line, &line_buff_size, fp);
173 if(line_read_size < 0){
174 printf(
"fatal: No fftTestInput for Poly");
179 line_read_size = getline(&line, &line_buff_size, fp);
180 if(line_read_size < 0){
181 printf(
"fatal: No fftTestOutput for Poly");
void parsefft(char *line, ffttest_t *fftTest, unsigned char input)
void parseSetup(char *line, ffttest_t *fftTest)
void freeffttest_t(ffttest_t *fftTest)
void parsefftInput(char *line, ffttest_t *fftTest)
ffttest_t parseFFTTest(const char *filename)
void parsefftOutput(char *line, ffttest_t *fftTest)
void parsePoly(char *line, ffttest_t *fftTest, ssize_t line_read_size)
void printTest(ffttest_t test)
uint768_t fftOutput[POLYLEN *2]
uint256_t polynomial[POLYLEN]
uint768_t fftInput[POLYLEN *2]
struct FFTTestCase * testCase
unsigned int polynomialLength