Skip to content

Commit

Permalink
[CI] update CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthou committed Oct 31, 2024
1 parent 60f056c commit 152e2b6
Show file tree
Hide file tree
Showing 6 changed files with 710 additions and 926 deletions.
8 changes: 4 additions & 4 deletions src/tests/CI/copy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ TEST(cpy_tests, reset)

const std::string indiv = "redCube";

EXPECT_TRUE(onto1.individual_graph_.getUp(indiv).size() == 11);
EXPECT_TRUE(onto2.individual_graph_.getUp(indiv).size() == 11);
EXPECT_EQ(onto1.individual_graph_.getUp(indiv).size(), 11);
EXPECT_EQ(onto2.individual_graph_.getUp(indiv).size(), 11);

std::string type = "cube";
onto2.individual_graph_.removeInheritage(indiv, type);
Expand All @@ -43,8 +43,8 @@ TEST(cpy_tests, reset)
std::cout << "onto1 " << onto1.individual_graph_.getUp(indiv).size() << std::endl;
std::cout << "onto2 " << onto2.individual_graph_.getUp(indiv).size() << std::endl;

EXPECT_TRUE(onto1.individual_graph_.getUp(indiv).size() == 11);
EXPECT_TRUE(onto2.individual_graph_.getUp(indiv).size() == 7);
EXPECT_EQ(onto1.individual_graph_.getUp(indiv).size(), 11);
EXPECT_EQ(onto2.individual_graph_.getUp(indiv).size(), 7);
}

int main(int argc, char** argv)
Expand Down
45 changes: 24 additions & 21 deletions src/tests/CI/globalFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ TEST(global_tests, reset)
{
std::vector<std::string> res;

std::string test_word = "affair";
res = onto_ptr->classes.find(test_word);
EXPECT_TRUE((res.size() == 1) && (res[0] == "affair"));
res = onto_ptr->classes.find("affair");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");

test_word = "centimeter";
res = onto_ptr->classes.find(test_word);
EXPECT_TRUE((res.size() == 1) && (res[0] == "centimeter"));
res = onto_ptr->classes.find("centimeter");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "centimeter");

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

test_word = "affair";
res = onto_ptr->classes.find(test_word);
EXPECT_FALSE((res.size() == 1) && (res[0] == "affair"));
res = onto_ptr->classes.find("affair");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");

test_word = "centimeter";
res = onto_ptr->classes.find(test_word);
EXPECT_FALSE((res.size() == 1) && (res[0] == "centimeter"));
res = onto_ptr->classes.find("centimeter");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "centimeter");

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

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

test_word = "affair";
res = onto_ptr->classes.find(test_word);
EXPECT_TRUE((res.size() == 1) && (res[0] == "affair"));
res = onto_ptr->classes.find("affair");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");

test_word = "centimeter";
res = onto_ptr->classes.find(test_word);
EXPECT_FALSE((res.size() == 1) && (res[0] == "centimeter"));
res = onto_ptr->classes.find("centimeter");
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "centimeter");
}

TEST(global_tests, language)
Expand All @@ -63,19 +63,22 @@ TEST(global_tests, language)

std::string test_word = "affair";
res = onto_ptr->classes.find(test_word);
EXPECT_TRUE((res.size() == 1) && (res[0] == "affair"));
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");

EXPECT_TRUE(onto_ptr->classes.getName(test_word) == "affair");
EXPECT_FALSE(onto_ptr->classes.getName(test_word) == "affaire");

EXPECT_TRUE(onto_ptr->actions.setLang("fr"));

res = onto_ptr->classes.find(test_word);
EXPECT_TRUE((res.size() == 1) && (res[0] == "affair"));
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");

test_word = "affaire";
res = onto_ptr->classes.find(test_word);
EXPECT_TRUE((res.size() == 1) && (res[0] == "affair"));
EXPECT_EQ(res.size(), 1);
EXPECT_EQ(res.front(), "affair");

test_word = "affair";
EXPECT_TRUE(onto_ptr->classes.getName(test_word) == "affaire");
Expand Down
78 changes: 17 additions & 61 deletions src/tests/CI/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,91 +9,47 @@ onto::OntologyManipulator* onto_ptr;

TEST(library_tests, close_call)
{
bool res_bool = onto_ptr->close();
EXPECT_TRUE(res_bool);
EXPECT_TRUE(onto_ptr->close());
}

TEST(library_tests, individuals_call)
{
std::string test_word = "test";
bool res_bool = true;

for(size_t i = 0; i < 10; i++)
{
std::vector<std::string> res = onto_ptr->individuals.getUp(test_word);
res_bool = res_bool && ((res.size() != 1) || (res[0] != "ERR:SERVICE_FAIL"));
}

EXPECT_TRUE(res_bool);
std::vector<std::string> res = onto_ptr->individuals.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, objectProperties_call)
{
std::string test_word = "test";
bool res_bool = true;

for(size_t i = 0; i < 10; i++)
{
std::vector<std::string> res = onto_ptr->objectProperties.getUp(test_word);
res_bool = res_bool && ((res.size() != 1) || (res[0] != "ERR:SERVICE_FAIL"));
}

EXPECT_TRUE(res_bool);
std::vector<std::string> res = onto_ptr->objectProperties.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, dataProperties_call)
{
std::string test_word = "test";
bool res_bool = true;

for(size_t i = 0; i < 10; i++)
{
std::vector<std::string> res = onto_ptr->dataProperties.getUp(test_word);
res_bool = res_bool && ((res.size() != 1) || (res[0] != "ERR:SERVICE_FAIL"));
}

EXPECT_TRUE(res_bool);
std::vector<std::string> res = onto_ptr->dataProperties.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, classes_call)
{
std::vector<std::string> res;
std::string test_word = "test";
bool res_bool = true;

for(size_t i = 0; i < 10; i++)
{
res = onto_ptr->classes.getUp(test_word);
res_bool = res_bool && ((res.size() != 1) || (res[0] != "ERR:SERVICE_FAIL"));
}

EXPECT_TRUE(res_bool);
std::vector<std::string> res = onto_ptr->classes.getUp("test");
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

TEST(library_tests, actions_call)
{
bool res_bool = true;

for(size_t i = 0; i < 10; i++)
{
res_bool = res_bool && onto_ptr->actions.setLang("en");
}

EXPECT_TRUE(res_bool);
EXPECT_TRUE(onto_ptr->actions.setLang("en"));
}

TEST(library_tests, reasoners_call)
{
std::vector<std::string> res;
bool res_bool = true;

for(size_t i = 0; i < 10; i++)
{
res = onto_ptr->reasoners.list();
res_bool = res_bool && ((res.size() != 1) || (res[0] != "ERR:SERVICE_FAIL"));
}

EXPECT_TRUE(res_bool);
std::vector<std::string> res = onto_ptr->reasoners.list();
EXPECT_NE(res.size(), 1);
EXPECT_NE(res.front(), "ERR:SERVICE_FAIL");
}

int main(int argc, char** argv)
Expand Down
Loading

0 comments on commit 152e2b6

Please sign in to comment.