idlize
1import {strict as assert} from 'assert';
2
3import {toArray, toInt32} from "../unit_utils"
4import {Tags} from "@arkoala/arkui/SerializerBase"
5import {Serializer} from "@arkoala/arkui/Serializer"
6
7it('Should resize capacity', function () {
8for (let size = 0; size < 8; size++) {
9let serializer = new Serializer(size)
10serializer.writeString(undefined)
11assert.deepEqual(toArray(serializer), [Tags.UNDEFINED])
12serializer.writeBoolean(true)
13assert.deepEqual(toArray(serializer), [Tags.UNDEFINED, 1])
14serializer.writeNumber(7)
15assert.deepEqual(toArray(serializer), [Tags.UNDEFINED, 1, Tags.INT32, ...toInt32(7)])
16serializer.writeNumber(8)
17assert.deepEqual(toArray(serializer), [Tags.UNDEFINED, 1, Tags.INT32, ...toInt32(7), Tags.INT32, ...toInt32(8)])
18}
19});
20