Skip to content

Bug: merge_sorted drops trailing elements #1

@windsornguyen

Description

@windsornguyen

Description

mathutils.core.merge_sorted drops the remaining elements when one input list is exhausted before the other.

Reproduction

from mathutils.core import merge_sorted

# Expected: [1, 2, 3, 4, 5]
# Actual:   [1, 2, 3, 4]
merge_sorted([1, 3, 5], [2, 4])

Failing tests

FAILED tests/test_core.py::test_merge_sorted_unequal_length
FAILED tests/test_core.py::test_merge_sorted_empty_left
FAILED tests/test_core.py::test_merge_sorted_empty_right

Expected behavior

After the main merge loop, the remaining elements from whichever list isn't exhausted should be appended to the result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions