diff --git a/src/mlpack/tests/main_tests/kmeans_test.cpp b/src/mlpack/tests/main_tests/kmeans_test.cpp index d7302310eb..e55399d764 100644 --- a/src/mlpack/tests/main_tests/kmeans_test.cpp +++ b/src/mlpack/tests/main_tests/kmeans_test.cpp @@ -231,7 +231,11 @@ BOOST_AUTO_TEST_CASE(KmClusteringEmptyClustersCheck) ResetKmSettings(); - BOOST_REQUIRE_GT(arma::accu(killEmptyOutput != allowEmptyOutput), 1); + if (killEmptyOutput.n_elem == allowEmptyOutput.n_elem) + { + BOOST_REQUIRE_GT(arma::accu(killEmptyOutput != allowEmptyOutput), 1); + BOOST_REQUIRE_GT(arma::accu(killEmptyOutput != normalOutput), 1); + } BOOST_REQUIRE_GT(arma::accu(normalOutput != allowEmptyOutput), 1); }