awtk/tests/fscripts/demo_wbuffer4.fs

12 lines
250 B
Forth
Raw Normal View History

2022-08-23 11:21:48 +08:00
var a = typed_array_create("i8", 8)
2021-01-14 09:23:11 +08:00
typed_array_push(a, 1, 2, 3, 4, 5, 6, 7, 8);
2022-08-23 11:21:48 +08:00
var b = wbuffer_attach(a.data, a.bytes)
2021-01-14 09:23:11 +08:00
assert(wbuffer_write_int8(b, 1, 2, 3, 4) == 4)
assert(b.cursor==4)
assert(b.capacity==8)
print(b.data, b.cursor, b.capacity)