@@ -15,7 +15,7 @@ describe("decodeArrayStream", () => {
1515 }
1616 } ;
1717
18- it ( "decodes numbers array" , async ( ) => {
18+ it ( "decodes numbers array (array8) " , async ( ) => {
1919 const object = [ 1 , 2 , 3 , 4 , 5 ] ;
2020
2121 const result : Array < unknown > = [ ] ;
@@ -27,6 +27,40 @@ describe("decodeArrayStream", () => {
2727 assert . deepStrictEqual ( object , result ) ;
2828 } ) ;
2929
30+ it ( "decodes numbers of array (array16)" , async ( ) => {
31+ const createStream = async function * ( ) {
32+ yield [ 0xdc , 0 , 3 ] ;
33+ yield encode ( 1 ) ;
34+ yield encode ( 2 ) ;
35+ yield encode ( 3 ) ;
36+ } ;
37+
38+ const result : Array < unknown > = [ ] ;
39+
40+ for await ( const item of decodeArrayStream ( createStream ( ) ) ) {
41+ result . push ( item ) ;
42+ }
43+
44+ assert . deepStrictEqual ( result , [ 1 , 2 , 3 ] ) ;
45+ } ) ;
46+
47+ it ( "decodes numbers of array (array32)" , async ( ) => {
48+ const createStream = async function * ( ) {
49+ yield [ 0xdd , 0 , 0 , 0 , 3 ] ;
50+ yield encode ( 1 ) ;
51+ yield encode ( 2 ) ;
52+ yield encode ( 3 ) ;
53+ } ;
54+
55+ const result : Array < unknown > = [ ] ;
56+
57+ for await ( const item of decodeArrayStream ( createStream ( ) ) ) {
58+ result . push ( item ) ;
59+ }
60+
61+ assert . deepStrictEqual ( result , [ 1 , 2 , 3 ] ) ;
62+ } ) ;
63+
3064 it ( "decodes objects array" , async ( ) => {
3165 const objectsArrays : Array < any > = [ ] ;
3266
0 commit comments