1dda321dbaee6470e6d48338678b0ab46a26787e
1 #include "TimeSeries/serialize.h"
6 static void checkFilesEqual(const char* fileName1
, const char* fileName2
)
8 FILE* output
= fopen(fileName1
, "rb");
9 FILE* refOutput
= fopen(fileName2
, "rb");
10 while (!feof(output
) && !feof(refOutput
))
11 LUT_ASSERT(fgetc(output
) == fgetc(refOutput
));
12 LUT_ASSERT(feof(output
) && feof(refOutput
));
19 const char* csvIfName
= "../data/test/sample_byCols.csv";
20 const char* binaryIfName
= "../data/test/sample_byCols.bin";
21 const char* tmpBinaryIfName
= "../data/test/sample_byCols.tmp.bin";
23 // serialize text file into a temporary binary file
24 serialize_byCols(csvIfName
, tmpBinaryIfName
, 0);
26 // compare binary result with reference
27 checkFilesEqual(tmpBinaryIfName
, binaryIfName
);
30 unlink(tmpBinaryIfName
);
35 const char* csvIfName
= "../data/test/sample_byRows.csv";
36 const char* binaryIfName
= "../data/test/sample_byRows.bin";
37 const char* tmpBinaryIfName
= "../data/test/sample_byRows.tmp.bin";
39 // serialize text file into a temporary binary file
40 serialize_byRows(csvIfName
, tmpBinaryIfName
, 0);
42 // compare binary result with reference
43 checkFilesEqual(tmpBinaryIfName
, binaryIfName
);
46 unlink(tmpBinaryIfName
);