Skip to content

Commit

Permalink
Refactor & revise Partition_One_Test
Browse files Browse the repository at this point in the history
  • Loading branch information
stcui007 committed Feb 26, 2024
1 parent 5cd7803 commit 81881c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
5 changes: 0 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ ngen_add_test(
utils/include/StreamOutputTest.cpp
realizations/Formulation_Manager_Test.cpp
utils/Partition_Test.cpp
utils/Partition_One_Test.cpp
utils/mdarray_Test.cpp
utils/mdframe_Test.cpp
utils/mdframe_netcdf_Test.cpp
Expand All @@ -461,16 +460,12 @@ ngen_add_test(
NGen::core_mediator
NGen::forcing
NGen::geojson
NGen::geopackage
NGen::realizations_catchment
NGen::mdarray
NGen::mdframe
NGen::logging
NGen::ngen_bmi
testbmicppmodel
REQUIRES
NGEN_WITH_SQLITE

)

# Discover for test_all
Expand Down
21 changes: 12 additions & 9 deletions test/utils/Partition_One_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ TEST_F(PartitionOneTest, TestPartitionData_1a)
std::set<std::string> duplicates;
//use set difference to identify all duplicates
std::set_difference(cat_id_vec.begin(), cat_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end()));
if( duplicates.size() > 0 ){
for( auto& id: duplicates){

for( auto& id: duplicates){
if (!id.empty()) {
std::cout << "duplicates string set is not empty" << std::endl;
break;
}
exit(1);
}

ASSERT_TRUE(true);
ASSERT_EQ(duplicates.size(), 0);
}

TEST_F(PartitionOneTest, TestPartitionData_1b)
Expand All @@ -151,12 +152,14 @@ TEST_F(PartitionOneTest, TestPartitionData_1b)
std::set<std::string> duplicates;
//use set difference to identify all duplicates
std::set_difference(nex_id_vec.begin(), nex_id_vec.end(), unique.begin(), unique.end(), std::inserter(duplicates, duplicates.end()));
if( duplicates.size() > 0 ){
for( auto& id: duplicates){

for( auto& id: duplicates){
if (!id.empty()) {
std::cout << "duplicates string set is not empty" << std::endl;
break;
}
exit(1);
}
ASSERT_TRUE(true);
ASSERT_EQ(duplicates.size(), 0);
}

#undef NGEN_MPI_ACTIVE

0 comments on commit 81881c7

Please sign in to comment.