tests/cpp: Add tests for metric.cc

This commit is contained in:
AbdealiJK 2016-12-04 12:42:18 +05:30 committed by Tianqi Chen
parent cc859420ba
commit 582c373274

View File

@ -0,0 +1,11 @@
// Copyright by Contributors
#include <xgboost/metric.h>
#include "../helpers.h"
TEST(Metric, UnknownMetric) {
EXPECT_ANY_THROW(xgboost::Metric::Create("unknown_name"));
EXPECT_NO_THROW(xgboost::Metric::Create("rmse"));
EXPECT_ANY_THROW(xgboost::Metric::Create("unknown_name@1"));
EXPECT_NO_THROW(xgboost::Metric::Create("error@0.5"));
}