Skip to content

Commit bd74ae5

Browse files
committed
Added tests for ArrayForTrees
1 parent 4e6bbc7 commit bd74ae5

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pydatastructs/linear_data_structures/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from .arrays import (
1111
OneDimensionalArray,
1212
DynamicOneDimensionalArray,
13-
MultiDimensionalArray
13+
MultiDimensionalArray,
14+
ArrayForTrees
1415
)
1516
__all__.extend(arrays.__all__)
1617

pydatastructs/linear_data_structures/tests/test_arrays.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pydatastructs.linear_data_structures import (
22
OneDimensionalArray, DynamicOneDimensionalArray,
3-
MultiDimensionalArray)
3+
MultiDimensionalArray, ArrayForTrees)
44
from pydatastructs.utils.misc_util import Backend
55
from pydatastructs.utils.raises_util import raises
66
from pydatastructs.utils import TreeNode
@@ -133,3 +133,16 @@ def test_DynamicOneDimensionalArray2():
133133
root = TreeNode(1, 100)
134134
A = DODA(TreeNode, [root])
135135
print(str(A[0]))
136+
137+
def test_ArrayForTrees():
138+
AFT = ArrayForTrees
139+
root = TreeNode(1, 100)
140+
A = AFT(TreeNode, [root])
141+
assert str(A[0]) == "(None, 1, 100, None)"
142+
143+
def test_cpp_ArrayForTrees():
144+
from pydatastructs.linear_data_structures._backend.cpp import _arrays
145+
AFT = _arrays.ArrayForTrees
146+
root = TreeNode(1, 100)
147+
A = AFT(TreeNode, [root])
148+
# ArrayForTrees has no __str__() method

0 commit comments

Comments
 (0)