Skip to content

Commit 37f300f

Browse files
author
Pablo David Aranda Rodriguez
committed
Fix tests
1 parent 4c1afee commit 37f300f

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

tests/test_ur_driver.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,23 +359,32 @@ TEST(UrDriverInitTest, no_recipe_throws_error)
359359
EXPECT_THROW(UrDriver ur_driver(config), UrException);
360360
}
361361

362-
TEST(UrDriverInitTest, non_existing_recipe_file_throws_exception)
362+
TEST(UrDriverInitTest, non_existing_output_recipe_file_throws_exception)
363363
{
364364
UrDriverConfiguration config;
365365
config.socket_reconnect_attempts = 1;
366366
config.socket_reconnection_timeout = std::chrono::milliseconds(200);
367367
config.robot_ip = g_ROBOT_IP; // That IP address should not exist on the test network
368-
config.input_recipe_file = " ";
369-
config.output_recipe_file = OUTPUT_RECIPE;
368+
config.input_recipe_file = INPUT_RECIPE;
369+
config.output_recipe_file = " ";
370370
config.headless_mode = g_HEADLESS;
371371

372372
EXPECT_THROW(UrDriver ur_driver(config), UrException);
373+
}
373374

374-
config.input_recipe_file = INPUT_RECIPE;
375-
config.output_recipe_file = " ";
375+
TEST(UrDriverInitTest, non_existing_input_recipe_file_does_not_throw_exception)
376+
{
377+
UrDriverConfiguration config;
378+
config.socket_reconnect_attempts = 1;
379+
config.socket_reconnection_timeout = std::chrono::milliseconds(200);
380+
config.robot_ip = g_ROBOT_IP; // That IP address should not exist on the test network
381+
config.output_recipe_file = OUTPUT_RECIPE;
382+
config.headless_mode = g_HEADLESS;
383+
384+
EXPECT_NO_THROW(THROW(UrDriver ur_driver(config));
376385
}
377386

378-
TEST(UrDriverInitTest, both_recipe_file_and_vector_select_file)
387+
TEST(UrDriverInitTest, both_recipe_file_and_vector_select_vector)
379388
{
380389
UrDriverConfiguration config;
381390
config.socket_reconnect_attempts = 1;
@@ -389,10 +398,10 @@ TEST(UrDriverInitTest, both_recipe_file_and_vector_select_file)
389398

390399
auto driver = UrDriver(config);
391400
auto output_recipe = driver.getRTDEOutputRecipe();
392-
EXPECT_TRUE(std::find(output_recipe.begin(), output_recipe.end(), OUTPUT_RECIPE_VECTOR_EXCLUDED_VALUE) !=
401+
EXPECT_TRUE(std::find(output_recipe.begin(), output_recipe.end(), OUTPUT_RECIPE_VECTOR_EXCLUDED_VALUE) ==
393402
output_recipe.end());
394403
auto input_recipe = driver.getRTDEInputRecipe();
395-
EXPECT_TRUE(std::find(input_recipe.begin(), input_recipe.end(), INPUT_RECIPE_VECTOR_EXCLUDED_VALUE) !=
404+
EXPECT_TRUE(std::find(input_recipe.begin(), input_recipe.end(), INPUT_RECIPE_VECTOR_EXCLUDED_VALUE) ==
396405
output_recipe.end());
397406
}
398407
// TODO we should add more tests for the UrDriver class.
@@ -417,4 +426,4 @@ int main(int argc, char* argv[])
417426
}
418427

419428
return RUN_ALL_TESTS();
420-
}
429+
}

0 commit comments

Comments
 (0)