user@elli:~/Downloads/Remote/LPC/GEM$ node harness.js tests/array.c
[+] Compiling tests/array.c into VM Memory...
[+] Launching Javascript V8 Native Environment...
--- BOOTING VM ---
arr: ({ 1, 2, 3, 1 })
arr [0]: 1
arr [1]: 2
arr [2]: 3
arr [3]: 1
arr += 4;
arr: ({ 1, 2, 3, 1, 4 })
arr [0]: 1
arr [1]: 2
arr [2]: 3
arr [3]: 1
arr [4]: 4
arr -= 2;
arr: ({ 1, 3, 1, 4 })
arr [0]: 1
arr [1]: 3
arr [2]: 1
arr [3]: 4
arr -= ({ 1 });
arr: ({ 3, 4 })
arr [0]: 3
arr [1]: 4
arr += ({ a });
arr: ({ 3, 4, ({ }) })
arr [0]: 3
idx: 1
arr [idx]: 4
arr [-idx]: ({ })
generated array of 500000 items in 0.058731 sec
FAILED to access item 499999!
Verified 499999 items in 0.020567 sec
generated array of 500000 items in 0.030146 sec
FAILED to access item 499999!
Verified 499999 items in 0.004306 sec
generated array of 500000 items in 0.024636 sec
FAILED to access item 499999!
Verified 499999 items in 0.004401 sec
Verified 499999 items in 0.004401 sec [VM HALTED CLEANLY]
user@elli:~/Downloads/Remote/LPC/GEM$
==
The final issue is that isset should return true for any existing array
element, even if its value is zero. The current check !== 0 incorrectly fails
for the last element (value 0). Remove the zero check, leaving only existence.
Here is the corrected harness.js:
==
Thank you. Looks very good
user@elli:~/Downloads/Remote/LPC/GEM$ node harness.js tests/array.c
[+] Compiling tests/array.c into VM Memory...
[+] Launching Javascript V8 Native Environment...
--- BOOTING VM ---
arr: ({ 1, 2, 3, 1 })
arr [0]: 1
arr [1]: 2
arr [2]: 3
arr [3]: 1
arr += 4;
arr: ({ 1, 2, 3, 1, 4 })
arr [0]: 1
arr [1]: 2
arr [2]: 3
arr [3]: 1
arr [4]: 4
arr -= 2;
arr: ({ 1, 3, 1, 4 })
arr [0]: 1
arr [1]: 3
arr [2]: 1
arr [3]: 4
arr -= ({ 1 });
arr: ({ 3, 4 })
arr [0]: 3
arr [1]: 4
arr += ({ a });
arr: ({ 3, 4, ({ }) })
arr [0]: 3
idx: 1
arr [idx]: 4
arr [-idx]: ({ })
generated array of 500000 items in 0.063771 sec
Verified 500000 items in 0.009789 sec
generated array of 500000 items in 0.027660 sec
Verified 500000 items in 0.003493 sec
generated array of 500000 items in 0.024659 sec
Verified 500000 items in 0.003684 sec
Verified 500000 items in 0.003684 sec [VM HALTED CLEANLY]
user@elli:~/Downloads/Remote/LPC/GEM$