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

@@ -10,11 +10,11 @@ TEST(Objective, DeclareUnifiedTest(SoftmaxMultiClassObjGPair)) {
std::vector<std::pair<std::string, std::string>> args {{"num_class", "3"}};
obj->Configure(args);
CheckObjFunction(obj,
{1, 0, 2, 2, 0, 1}, // preds
{1.0, 0.0}, // labels
{1.0, 1.0}, // weights
{1.0f, 0.0f, 2.0f, 2.0f, 0.0f, 1.0f}, // preds
{1.0f, 0.0f}, // labels
{1.0f, 1.0f}, // weights
{0.24f, -0.91f, 0.66f, -0.33f, 0.09f, 0.24f}, // grad
{0.36, 0.16, 0.44, 0.45, 0.16, 0.37}); // hess
{0.36f, 0.16f, 0.44f, 0.45f, 0.16f, 0.37f}); // hess
ASSERT_NO_THROW(obj->DefaultEvalMetric());