()
| 136 | |
| 137 | |
| 138 | def 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 | |
| 172 | def test_linked_list_forward(): |
nothing calls this directly
no test coverage detected