44 lines
480 B
Plaintext

import mem
main() {
a := mem.alloc(5)
assert a[0] == 0
assert a[1] == 0
assert a[2] == 0
assert a[3] == 0
assert a[4] == 0
a[0] = 0
a[1] = 1
a[2] = 2
a[3] = 3
a[4] = 4
assert a[0] == 0
assert a[1] == 1
assert a[2] == 2
assert a[3] == 3
assert a[4] == 4
i := 0
a[i] = i * 2
i += 1
a[i] = i * 2
i += 1
a[i] = i * 2
i += 1
a[i] = i * 2
i += 1
a[i] = i * 2
assert a[0] == 0
assert a[1] == 2
assert a[2] == 4
assert a[3] == 6
assert a[4] == 8
}