1
// from Sean T Barrett - vector trash bug test case
7
#define TEST_STRINGS // if you disable this, builds a vector of ints,
8
// which doesn't memory trash
18
local x = new Vector(1); // if you make this 3, it doesn't trash
19
// (the vector will eventually have 3 elements)
21
x.append(VALUE(1)); // append 1 or '1'
22
x.append(VALUE(2)); // append 2 or '2'
24
x[2] = x[2]; // this assignment doesn't trash x[1] or x[2]
26
"<<x[1]>> <<x[2]>>\n";
28
x.append(VALUE(3)); // append 3 or '3'
30
"<<x[1]>> <<x[2]>> <<x[3]>>\n";
32
x[3] = 3; // ERROR! this assignment trashes x[2] NOT x[3]
33
// x[3] = x[3]; // this would trash too
35
"<<x[1]>> <<x[2]>>\n"; // this line will fault on x[2]
37
// convert it to a list and display it
39
"y = [<<y[1]>>, <<y[2]>>, <<y[3]>>]\n";