xgboost/tests/cpp/plugin/test_example_objective.cc
Jiaming Yuan 3e26107a9c
Rename and extract Context. (#8528)
* Rename `GenericParameter` to `Context`.
* Rename header file to reflect the change.
* Rename all references.
2022-12-07 04:58:54 +08:00

16 lines
379 B
C++

#include <gtest/gtest.h>
#include <xgboost/objective.h>
#include <string>
#include "../helpers.h"
namespace xgboost {
TEST(Plugin, ExampleObjective) {
xgboost::Context ctx = CreateEmptyGenericParam(GPUIDX);
auto* obj = xgboost::ObjFunction::Create("mylogistic", &ctx);
ASSERT_EQ(obj->DefaultEvalMetric(), std::string{"logloss"});
delete obj;
}
} // namespace xgboost