Small refinements for JSON model. (#5112)

* Naming consistency.

* Remove duplicated test.
This commit is contained in:
Jiaming Yuan
2019-12-11 19:49:01 +08:00
committed by GitHub
parent 208ab3b1ff
commit ad4a1c732c
7 changed files with 19 additions and 30 deletions

View File

@@ -35,22 +35,14 @@ TEST(GBLinear, Json_IO) {
std::string model_str;
Json::Dump(model, &model_str);
model = Json::Load({model_str.c_str(), model_str.size()});
model = Json::Load(StringView{model_str.c_str(), model_str.size()});
ASSERT_TRUE(IsA<Object>(model));
model = model["model"];
{
model = model["model"];
auto weights = get<Array>(model["weights"]);
ASSERT_EQ(weights.size(), 17);
}
{
model = Json::Load({model_str.c_str(), model_str.size()});
model = model["model"];
auto weights = get<Array>(model["weights"]);
ASSERT_EQ(weights.size(), 17); // 16 + 1 (bias)
}
}
} // namespace gbm