treeSitterArray025ParityProbe function
Deterministic managed transcript corresponding to the pinned native
Tree-sitter 0.25.10 array.h oracle.
Implementation
List<String> treeSitterArray025ParityProbe() {
String state(String name, TreeSitterArray<int> value) =>
'$name=${value.size}:${value.capacity}:[${value.values.join(',')}]';
final growth = TreeSitterArray<int>(zeroValue: () => 0);
final transcript = <String>[state('array_new', growth)];
growth.reserve(3);
transcript.add(state('reserve_three', growth));
growth.reserve(2);
transcript.add(state('reserve_smaller', growth));
for (var value = 1; value <= 3; value++) growth.push(value);
transcript.add(state('fill_reserved', growth));
growth.push(4);
transcript.add(state('grow_min_eight', growth));
for (var value = 5; value <= 8; value++) growth.push(value);
transcript.add(state('fill_eight', growth));
growth.push(9);
transcript.add(state('grow_double', growth));
growth.grow(20);
transcript.add(state('grow_large_count', growth));
final source = TreeSitterArray<int>.from(const [4, 5, 6], zeroValue: () => 0);
final assigned = TreeSitterArray<int>(zeroValue: () => 0)..reserve(10);
assigned.assign(source);
transcript.add(state('assign_retains_capacity', assigned));
final splice = TreeSitterArray<int>.from(const [
0,
1,
2,
3,
4,
5,
], zeroValue: () => 0);
splice.splice(2, 0, 2, const [8, 9]);
transcript.add(state('splice_overlap_right', splice));
splice.splice(3, 3, 0, null);
transcript.add(state('splice_overlap_left', splice));
splice.splice(1, 1, 3, const [7, 6, 5]);
transcript.add(state('splice_replace', splice));
splice.splice(2, 1, 2, null);
transcript.add(state('splice_zero_insert', splice));
splice.erase(3);
transcript.add(state('erase_middle', splice));
final swapLeft = TreeSitterArray<int>.from(const [1, 2], zeroValue: () => 0);
final swapRight = TreeSitterArray<int>.from(const [9], zeroValue: () => 0)
..reserve(12);
swapLeft.swap(swapRight);
transcript
..add(state('swap_left', swapLeft))
..add(state('swap_right', swapRight));
assigned.delete();
transcript.add(state('delete', assigned));
assigned.delete();
transcript.add(state('delete_again', assigned));
assigned.push(42);
transcript.add(state('reuse_after_delete', assigned));
return transcript;
}