Skip to content

Commit

Permalink
Only check for failure
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Nov 26, 2023
1 parent bf53bf7 commit e23f202
Showing 1 changed file with 1 addition and 251 deletions.
252 changes: 1 addition & 251 deletions nexus_motion_planner/test/test_motion_plan_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,257 +134,7 @@ def wrapped(output):


@pytest.mark.launch(fixture=launch_description)
def test_read_stdout(motion_cache_test_runner_node, launch_context):
test_cases = [
# Cache init
('init', [
'Cache init',
]),

# Motion plan cache
('test_motion_plans.empty', [
'Plan cache initially empty',
'Fetch all plans on empty cache returns empty',
'Fetch best plan on empty cache returns nullptr',
]),

('test_motion_plans.put_plan_empty_frame', [
'Put empty frame plan, no delete_worse_plans, not ok',
'No plans in cache',
]),

('test_motion_plans.put_plan_req_empty_frame', [
'Put empty frame req plan, no delete_worse_plans, not ok',
'No plans in cache',
]),

('test_motion_plans.put_first', [
'Put first valid plan, no delete_worse_plans, ok',
'One plan in cache',
]),
('test_motion_plans.put_first.fetch_matching_no_tolerance', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
]),
('test_motion_plans.put_first.fetch_is_diff_no_tolerance', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
]),
('test_motion_plans.put_first.fetch_non_matching_out_of_tolerance', [
'Fetch all returns empty',
'Fetch best plan is nullptr',
]),
('test_motion_plans.put_first.fetch_non_matching_in_tolerance', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
]),
('test_motion_plans.put_first.fetch_swapped', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
]),
('test_motion_plans.put_first.fetch_smaller_workspace', [
'Fetch all returns empty',
'Fetch best plan is nullptr',
]),
('test_motion_plans.put_first.fetch_larger_workspace', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has more restrictive workspace max_corner',
'Fetched plan has more restrictive workspace min_corner',
]),

('test_motion_plans.put_worse', [
'Put worse plan, no delete_worse_plans, not ok',
'One plan in cache',
]),

('test_motion_plans.put_better', [
'Put better plan, no delete_worse_plans, ok',
'Two plans in cache',
]),
('test_motion_plans.put_better.fetch_sorted', [
'Fetch all returns two',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plans are sorted correctly',
]),

('test_motion_plans.put_better_delete_worse_plans', [
'Put better plan, delete_worse_plans, ok',
'One plan in cache',
]),
('test_motion_plans.put_better_delete_worse_plans.fetch', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
]),

('test_motion_plans.put_different_req', [
'Put different plan req, delete_worse_plans, ok',
'Two plans in cache',
]),
('test_motion_plans.put_different_req.fetch', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
]),

# Cartesian plan cache
('test_cartesian_plans.construct_get_cartesian_path_request', [
'Ok',
]),

('test_cartesian_plans.empty', [
'Plan cache initially empty',
'Fetch all plans on empty cache returns empty',
'Fetch best plan on empty cache returns nullptr',
]),

('test_cartesian_plans.put_plan_empty_frame', [
'Put empty frame plan, no delete_worse_plans, not ok',
'No plans in cache',
]),

('test_cartesian_plans.put_plan_req_empty_frame', [
'Put empty frame req plan, no delete_worse_plans, not ok',
'No plans in cache',
]),

('test_cartesian_plans.put_first', [
'Put first valid plan, no delete_worse_plans, ok',
'One plan in cache',
]),
('test_cartesian_plans.put_first.fetch_matching_no_tolerance', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
]),
('test_cartesian_plans.put_first.fetch_is_diff_no_tolerance', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
]),
('test_cartesian_plans.put_first.fetch_non_matching_out_of_tolerance', [
'Fetch all returns empty',
'Fetch best plan is nullptr',
]),
('test_cartesian_plans.put_first.fetch_non_matching_in_tolerance', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
]),
('test_cartesian_plans.put_first.fetch_higher_fraction', [
'Fetch all returns empty',
'Fetch best plan is nullptr',
]),
('test_cartesian_plans.put_first.fetch_lower_fraction', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
]),

('test_cartesian_plans.put_worse', [
'Put worse plan, no delete_worse_plans, not ok',
'One plan in cache',
]),

('test_cartesian_plans.put_better', [
'Put better plan, no delete_worse_plans, ok',
'Two plans in cache',
]),
('test_cartesian_plans.put_better.fetch_sorted', [
'Fetch all returns two',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
'Fetched plans are sorted correctly',
]),
('test_cartesian_plans.put_better_delete_worse_plans', [
'Put better plan, delete_worse_plans, ok',
'One plan in cache',
]),
('test_cartesian_plans.put_better_delete_worse_plans.fetch', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
]),

('test_cartesian_plans.put_different_req', [
'Put different plan req, delete_worse_plans, ok',
'Two plans in cache',
]),
('test_cartesian_plans.put_different_req.fetch', [
'Fetch all returns one',
'Fetch best plan is not nullptr',
'Fetched plan on both fetches match',
'Fetched plan matches original',
'Fetched plan has correct execution time',
'Fetched plan has correct planning time',
'Fetched plan has correct fraction',
]),
]

for prefix, labels in test_cases:
for label in labels:
process_tools.assert_output_sync(
launch_context,
motion_cache_test_runner_node,
validate_stream(f"[PASS] {prefix}: {label}"),
timeout=10
)

def test_all_tests_pass(motion_cache_test_runner_node, launch_context):
# Check no occurrences of [FAIL] in output
assert not process_tools.wait_for_output_sync(
launch_context,
Expand Down

0 comments on commit e23f202

Please sign in to comment.