Skip to content

Commit

Permalink
[CI] prevent call to front if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthou committed Oct 31, 2024
1 parent 8ebb6ff commit 6740952
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/tests/CI/anonymous_class_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,4 @@ int main(int argc, char** argv)

testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();

return 0;
}
2 changes: 0 additions & 2 deletions src/tests/CI/chain_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,4 @@ int main(int argc, char** argv)

testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();

return 0;
}
27 changes: 18 additions & 9 deletions src/tests/CI/globalFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ TEST(global_tests, reset)

res = onto_ptr->classes.find("affair");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");
if(res.empty() == false)
EXPECT_EQ(res.front(), "affair");

res = onto_ptr->classes.find("centimeter");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "centimeter");
if(res.empty() == false)
EXPECT_EQ(res.front(), "centimeter");

EXPECT_TRUE(onto_ptr->actions.clear());
EXPECT_TRUE(onto_ptr->actions.close());

res = onto_ptr->classes.find("affair");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");
if(res.empty() == false)
EXPECT_EQ(res.front(), "affair");

res = onto_ptr->classes.find("centimeter");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "centimeter");
if(res.empty() == false)
EXPECT_EQ(res.front(), "centimeter");

EXPECT_TRUE(onto_ptr->actions.clear());
std::string path = ros::package::getPath("ontologenius");
Expand All @@ -41,11 +45,13 @@ TEST(global_tests, reset)

res = onto_ptr->classes.find("affair");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");
if(res.empty() == false)
EXPECT_EQ(res.front(), "affair");

res = onto_ptr->classes.find("centimeter");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "centimeter");
if(res.empty() == false)
EXPECT_EQ(res.front(), "centimeter");
}

TEST(global_tests, language)
Expand All @@ -64,7 +70,8 @@ TEST(global_tests, language)
std::string test_word = "affair";
res = onto_ptr->classes.find(test_word);
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");
if(res.empty() == false)
EXPECT_EQ(res.front(), "affair");

EXPECT_TRUE(onto_ptr->classes.getName(test_word) == "affair");
EXPECT_FALSE(onto_ptr->classes.getName(test_word) == "affaire");
Expand All @@ -73,12 +80,14 @@ TEST(global_tests, language)

res = onto_ptr->classes.find(test_word);
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");
if(res.empty() == false)
EXPECT_EQ(res.front(), "affair");

test_word = "affaire";
res = onto_ptr->classes.find(test_word);
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");
if(res.empty() == false)
EXPECT_EQ(res.front(), "affair");

test_word = "affair";
EXPECT_TRUE(onto_ptr->classes.getName(test_word) == "affaire");
Expand Down
12 changes: 8 additions & 4 deletions src/tests/CI/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,32 @@ TEST(library_tests, individuals_call)
{
std::vector<std::string> res = onto_ptr->individuals.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
if(res.empty() == false)
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, objectProperties_call)
{
std::vector<std::string> res = onto_ptr->objectProperties.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
if(res.empty() == false)
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, dataProperties_call)
{
std::vector<std::string> res = onto_ptr->dataProperties.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
if(res.empty() == false)
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, classes_call)
{
std::vector<std::string> res = onto_ptr->classes.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
if(res.empty() == false)
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, actions_call)
Expand Down
Empty file added src/tests/CI/subscription.cpp
Empty file.
2 changes: 0 additions & 2 deletions src/tests/CI/transitivity_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,4 @@ int main(int argc, char** argv)

testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();

return 0;
}

0 comments on commit 6740952

Please sign in to comment.