20 void FileContent::init() {
21 FILE *fp = fopen(path,
"rb");
29 while (buf.getLine(line)) {
38 FILE *out = fopen(path,
"wt");
42 for (
size_t i = 0; i<Lines.size(); ++i) {
46 failed = fclose(out) != 0;
64 for (
size_t i = 0; i<expected.size(); ++i) {
67 return all().of(same_size, eq);
74 #define TEST_EXPECT_READS_SAME(fc,name) do { \
75 FileContent oc(name); \
76 TEST_EXPECTATION(arrays_equal(fc.lines(), oc.lines())); \
79 void TEST_linefeed_conversion() {
80 const char *funix =
"general/text.input";
81 const char *fdos =
"general/dos.input";
82 const char *fmac =
"general/mac.input";
83 const char *fbroken =
"general/broken_LF.input";
94 TEST_EXPECT_READS_SAME(cunix,fdos);
95 TEST_EXPECT_READS_SAME(cunix,fmac);
96 TEST_EXPECT_READS_SAME(cunix,fbroken);
GB_ERROR GB_IO_error(const char *action, const char *filename)
char * ARB_stringdup(const std::string &str)
long GB_size_of_file(const char *path)
#define TEST_PUBLISH(testfunction)
static void error(const char *msg)
fputs(TRACE_PREFIX, stderr)
bool fulfilled() const OVERRIDE
#define TEST_EXPECT_EQUAL(expr, want)