src/test/01-Basic/280-array-capacity.ck
raw| 1 | // unit test to make sure that setting capacity < size does not |
| 2 | // alter size or any within-size array elements |
| 3 | |
| 4 | // array |
| 5 | [1,2,3,4,5] @=> int x[]; |
| 6 | // current size |
| 7 | <<< "size:", x.size() >>>; |
| 8 | // set capacity less than size |
| 9 | 2 => x.capacity; |
| 10 | // size (should not change) |
| 11 | <<< "size:", x.size() >>>; |
| 12 | // contents should be intact |
| 13 | for( int a : x ) <<< a >>>; |