(i int)
| 81 | } |
| 82 | |
| 83 | func (t *testDynArray) SetLen(i int) bool { |
| 84 | if i > len(t.a) { |
| 85 | t.expand(i) |
| 86 | return true |
| 87 | } |
| 88 | if i < 0 { |
| 89 | return false |
| 90 | } |
| 91 | if i < len(t.a) { |
| 92 | tail := t.a[i:len(t.a)] |
| 93 | for j := range tail { |
| 94 | tail[j] = nil |
| 95 | } |
| 96 | t.a = t.a[:i] |
| 97 | } |
| 98 | return true |
| 99 | } |
| 100 | |
| 101 | func TestDynamicObject(t *testing.T) { |
| 102 | vm := New() |