|
@ -1,4 +1,5 @@ |
|
|
#include "userinput.h" |
|
|
#include "userinput.h" |
|
|
|
|
|
#include "fakeinput.h" |
|
|
|
|
|
|
|
|
#include <ctype.h> |
|
|
#include <ctype.h> |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
@ -9,6 +10,8 @@ |
|
|
#include <limits.h> |
|
|
#include <limits.h> |
|
|
#include <float.h> |
|
|
#include <float.h> |
|
|
|
|
|
|
|
|
|
|
|
char **fakeInput = NULL; |
|
|
|
|
|
|
|
|
#define LD(name)\ |
|
|
#define LD(name)\ |
|
|
long double name##ldvalue;\ |
|
|
long double name##ldvalue;\ |
|
|
long double *name##ld = NULL;\ |
|
|
long double *name##ld = NULL;\ |
|
@ -39,6 +42,16 @@ void trimRight(char *input) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
char *readInput() { |
|
|
char *readInput() { |
|
|
|
|
|
if (fakeInput != NULL) { |
|
|
|
|
|
if (fakeInput[0] == NULL) { |
|
|
|
|
|
printf("The given list of inputs in the test was exceeded!\n"); |
|
|
|
|
|
exit(1); |
|
|
|
|
|
} |
|
|
|
|
|
char *result = malloc(strlen(fakeInput[0])*sizeof(char) + 1); |
|
|
|
|
|
strcpy(result, fakeInput[0]); |
|
|
|
|
|
fakeInput = fakeInput + 1; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
size_t bufferSize = 100; |
|
|
size_t bufferSize = 100; |
|
|
char *buffer = malloc(bufferSize*sizeof(char)); |
|
|
char *buffer = malloc(bufferSize*sizeof(char)); |
|
|
char c; |
|
|
char c; |
|
|