test_utils.h
Go to the documentation of this file.
1#ifndef TEST_UTILS_H
2#define TEST_UTILS_H
3
4#include <fplll.h>
5using namespace std;
6using namespace fplll;
7
15template <class T> int read_file(T &X, const char *input_filename) {
16 int status = 0;
17 ifstream is;
18 is.exceptions(std::ifstream::failbit | std::ifstream::badbit);
19 try {
20 is.open(input_filename);
21 is >> X;
22 is.close();
23 }
24 catch (const ifstream::failure&) {
25 status = 1;
26 cerr << "Error by reading " << input_filename << "." << endl;
27 }
28
29 return status;
30}
31#endif /* TEST_UTILS_H */
int read_file(T &X, const char *input_filename)
Read T from input_filename.
Definition: test_utils.h:15