MCPcopy
hub / github.com/pathwaycom/pathway / test_linked_list_reversal

Function test_linked_list_reversal

python/pathway/tests/test_examples.py:138–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136
137
138def test_linked_list_reversal():
139 nodes = T(
140 """
141 | next
142 1 | 2
143 2 | 3
144 3 | 4
145 4 | 5
146 5 | 6
147 6 | 7
148 7 | 8
149 8 |
150 """,
151 )
152 nodes = nodes.select(next=nodes.pointer_from(this.next, optional=True))
153 expected = T(
154 """
155 | next
156 1 |
157 2 | 1
158 3 | 2
159 4 | 3
160 5 | 4
161 6 | 5
162 7 | 6
163 8 | 7
164 """,
165 ).select(next=nodes.pointer_from(this.next, optional=True))
166
167 ret = reverse_linked_list(nodes)
168
169 assert_table_equality(ret, expected)
170
171
172def test_linked_list_forward():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
reverse_linked_listFunction · 0.85
selectMethod · 0.45
pointer_fromMethod · 0.45

Tested by

no test coverage detected