* Add travis sanitizers tests. * Add gcc-7 in Travis. * Add SANITIZER_PATH for CMake. * Enable sanitizer tests in Travis. * Fix memory leaks in tests. * Fix all memory leaks reported by Address Sanitizer. * tests/cpp/helpers.h/CreateDMatrix now returns raw pointer.
15 lines
447 B
C++
15 lines
447 B
C++
// Copyright by Contributors
|
|
#include <xgboost/metric.h>
|
|
|
|
#include "../helpers.h"
|
|
|
|
TEST(Metric, UnknownMetric) {
|
|
xgboost::Metric * metric;
|
|
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name"));
|
|
EXPECT_NO_THROW(metric = xgboost::Metric::Create("rmse"));
|
|
delete metric;
|
|
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name@1"));
|
|
EXPECT_NO_THROW(metric = xgboost::Metric::Create("error@0.5f"));
|
|
delete metric;
|
|
}
|