1 # Tests for dynamic arrays.
4 write_blob_to_stream blob standard_output
5 write_newline_and_flush_stream standard_output
12 var arr = dynarray 0 0
13 set @arr dynarray_add @arr @foo
14 dynarray_each puts @arr
16 var items = allocate_words 2
17 set-word @items 0 @bar
18 set-word @items 1 @baz
19 set @arr dynarray 2 @items
20 dynarray_each puts @arr
22 var regular_array = dynarray_to_array @arr
23 array_each puts @regular_array
25 dynarray_add @arr @foo
26 dynarray_add @arr @bar
27 dynarray_add @arr @baz
28 dynarray_add @arr @foo
29 dynarray_add @arr @bar
30 dynarray_add @arr @baz
31 dynarray_add @arr @foo
32 dynarray_add @arr @bar
33 dynarray_add @arr @baz
34 dynarray_add @arr @foo
35 dynarray_add @arr @bar
36 dynarray_add @arr @baz
37 dynarray_add @arr @foo
38 dynarray_add @arr @bar
39 dynarray_add @arr @baz
40 dynarray_add @arr @foo
41 dynarray_add @arr @bar
42 dynarray_add @arr @baz
43 dynarray_each puts @arr