Merge pull request #557 from avzhatkin/master

Fix unit test golden file compare on Windows-- explicitly open files as binary.
This commit is contained in:
Tom Finegan 2019-09-25 14:22:13 -07:00 committed by GitHub
commit 736190f80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ bool GenerateGoldenFile(const std::string &golden_file_name, const void *data,
bool CompareGoldenFile(const std::string &golden_file_name, const void *data, bool CompareGoldenFile(const std::string &golden_file_name, const void *data,
int data_size) { int data_size) {
const std::string golden_path = GetTestFileFullPath(golden_file_name); const std::string golden_path = GetTestFileFullPath(golden_file_name);
std::ifstream in_file(golden_path); std::ifstream in_file(golden_path, std::ios::binary);
if (!in_file || data_size < 0) if (!in_file || data_size < 0)
return false; return false;
const char *const data_c8 = static_cast<const char *>(data); const char *const data_c8 = static_cast<const char *>(data);