Unverified Commit 0c0eb2a6 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[tests] Fix cpp streaming data tests (#5481)

parent f5dd320e
......@@ -35,6 +35,9 @@ void test_stream_dense(
int has_init_scores = init_scores != nullptr;
int has_queries = groups != nullptr;
bool succeeded = true;
std::string exceptionText("");
try {
int result = 0;
switch (creation_type) {
......@@ -111,13 +114,19 @@ void test_stream_dense(
init_scores,
groups);
}
catch (...) {
catch (std::exception& ex) {
succeeded = false;
exceptionText = std::string(ex.what());
}
if (dataset_handle) {
int result = LGBM_DatasetFree(dataset_handle);
EXPECT_EQ(0, result) << "LGBM_DatasetFree result code: " << result;
}
if (!succeeded) {
FAIL() << "Test Dense Stream failed with exception: " << exceptionText;
}
}
void test_stream_sparse(
......@@ -142,6 +151,9 @@ void test_stream_sparse(
int has_init_scores = init_scores != nullptr;
int has_queries = groups != nullptr;
bool succeeded = true;
std::string exceptionText("");
try {
int result = 0;
switch (creation_type) {
......@@ -220,13 +232,19 @@ void test_stream_sparse(
init_scores,
groups);
}
catch (...) {
catch (std::exception& ex) {
succeeded = false;
exceptionText = std::string(ex.what());
}
if (dataset_handle) {
int result = LGBM_DatasetFree(dataset_handle);
EXPECT_EQ(0, result) << "LGBM_DatasetFree result code: " << result;
}
if (!succeeded) {
FAIL() << "Test Sparse Stream failed with exception: " << exceptionText;
}
}
TEST(Stream, PushDenseRowsWithMetadata) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment