codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
199 stars 270 forks source link

SEGFAULT in CI but works locally #563

Open Kishan-Ved opened 6 days ago

Kishan-Ved commented 6 days ago

Description of the problem

In the file: pydatastructs/trees/tests/test_binary_trees.py, inside the _test_SplayTree() function: There are 2 code snippets which run only when the backend is Python. This is because if we run them in C++ backend, the CI checks fail. However, the code passes when run on my local machine (laptop - Ubuntu).

These are the code snippets:

    if(backend==Backend.PYTHON):
        trav3 = BinaryTreeTraversal(t, backend=backend)
        in_order = trav3.depth_first_search(order='in_order')
        pre_order = trav3.depth_first_search(order='pre_order')
        assert [node.key for node in in_order] == [20, 30, 50, 55, 100, 200, 1000, 2000]
        assert [node.key for node in pre_order] == [200, 55, 50, 30, 20, 100, 2000, 1000]
    if(backend==Backend.PYTHON):
        trav5 = BinaryTreeTraversal(t, backend=backend)
        in_order = trav5.depth_first_search(order='in_order')
        pre_order = trav5.depth_first_search(order='pre_order')
        assert [node.key for node in in_order] == [20, 30, 50, 55, 100, 200]
        assert [node.key for node in pre_order] == [200, 55, 50, 30, 20, 100]

This was added in PR: https://github.com/codezonediitj/pydatastructs/pull/562