Make C++ unit tests run and pass on Windows (#3869)

* Make C++ unit tests run and pass on Windows

* Fix logic for external memory. The letter ':' is part of drive letter,
so remove the drive letter before splitting on ':'.
* Cosmetic syntax changes to keep MSVC happy.

* Fix lint

* Add Windows guard
This commit is contained in:
Philip Hyunsu Cho
2018-11-06 17:17:24 -08:00
committed by GitHub
parent d9642cf757
commit 2b045aa805
6 changed files with 67 additions and 41 deletions

View File

@@ -5,12 +5,12 @@
#include "xgboost/c_api.h"
#include <random>
bool FileExists(const std::string name) {
bool FileExists(const std::string& filename) {
struct stat st;
return stat(name.c_str(), &st) == 0;
return stat(filename.c_str(), &st) == 0;
}
long GetFileSize(const std::string filename) {
long GetFileSize(const std::string& filename) {
struct stat st;
stat(filename.c_str(), &st);
return st.st_size;