@nnilky/structo 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +31 -7
- package/structo/datatypes/containers/__snapshots__/list.test.ts.snap +0 -25
- package/structo/datatypes/containers/__snapshots__/object.test.ts.snap +0 -37
- package/structo/datatypes/containers/array.test.ts +0 -28
- package/structo/datatypes/containers/array.ts +0 -24
- package/structo/datatypes/containers/fastObject.ts +0 -66
- package/structo/datatypes/containers/list.test.ts +0 -44
- package/structo/datatypes/containers/list.ts +0 -29
- package/structo/datatypes/containers/object.test.ts +0 -42
- package/structo/datatypes/containers/object.ts +0 -40
- package/structo/datatypes/containers/sizedbuffer.test.ts +0 -34
- package/structo/datatypes/containers/sizedbuffer.ts +0 -20
- package/structo/datatypes/index.ts +0 -18
- package/structo/datatypes/lazy.ts +0 -0
- package/structo/datatypes/numbers/__snapshots__/bigints.test.ts.snap +0 -261
- package/structo/datatypes/numbers/__snapshots__/floats.test.ts.snap +0 -191
- package/structo/datatypes/numbers/__snapshots__/sints.test.ts.snap +0 -321
- package/structo/datatypes/numbers/__snapshots__/uints.test.ts.snap +0 -321
- package/structo/datatypes/numbers/bigints.test.ts +0 -85
- package/structo/datatypes/numbers/bigints.ts +0 -48
- package/structo/datatypes/numbers/floats.test.ts +0 -91
- package/structo/datatypes/numbers/floats.ts +0 -33
- package/structo/datatypes/numbers/sints.test.ts +0 -109
- package/structo/datatypes/numbers/sints.ts +0 -83
- package/structo/datatypes/numbers/uints.test.ts +0 -110
- package/structo/datatypes/numbers/uints.ts +0 -82
- package/structo/datatypes/transforms/pipe.test.ts +0 -17
- package/structo/datatypes/transforms/pipe.ts +0 -88
- package/structo/datatypes/transforms/readOffset.ts +0 -20
- package/structo/datatypes/transforms/transform.ts +0 -15
- package/structo/datatypes/utils.test.ts +0 -39
- package/structo/datatypes/values/buffer.test.ts +0 -52
- package/structo/datatypes/values/buffer.ts +0 -20
- package/structo/datatypes/values/byteliteral.ts +0 -24
- package/structo/datatypes/values/string.test.ts +0 -22
- package/structo/datatypes/values/string.ts +0 -28
- package/structo/index.ts +0 -11
- package/structo/read.ts +0 -14
- package/structo/types.ts +0 -21
- package/structo/utils.test.ts +0 -0
- package/structo/write.ts +0 -43
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
-
|
|
3
|
-
exports[`st.s8 matches snapshots 1`] = `
|
|
4
|
-
ArrayBuffer [
|
|
5
|
-
0,
|
|
6
|
-
]
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
exports[`st.s8 matches snapshots 2`] = `
|
|
10
|
-
ArrayBuffer [
|
|
11
|
-
128,
|
|
12
|
-
]
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`st.s8 matches snapshots 3`] = `
|
|
16
|
-
ArrayBuffer [
|
|
17
|
-
138,
|
|
18
|
-
]
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
exports[`st.s8 matches snapshots 4`] = `
|
|
22
|
-
ArrayBuffer [
|
|
23
|
-
117,
|
|
24
|
-
]
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`st.s8 matches snapshots 5`] = `
|
|
28
|
-
ArrayBuffer [
|
|
29
|
-
127,
|
|
30
|
-
]
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`st.s16(little) matches snapshots 1`] = `
|
|
34
|
-
ArrayBuffer [
|
|
35
|
-
0,
|
|
36
|
-
0,
|
|
37
|
-
]
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
exports[`st.s16(little) matches snapshots 2`] = `
|
|
41
|
-
ArrayBuffer [
|
|
42
|
-
0,
|
|
43
|
-
128,
|
|
44
|
-
]
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
exports[`st.s16(little) matches snapshots 3`] = `
|
|
48
|
-
ArrayBuffer [
|
|
49
|
-
10,
|
|
50
|
-
128,
|
|
51
|
-
]
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
exports[`st.s16(little) matches snapshots 4`] = `
|
|
55
|
-
ArrayBuffer [
|
|
56
|
-
245,
|
|
57
|
-
127,
|
|
58
|
-
]
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
exports[`st.s16(little) matches snapshots 5`] = `
|
|
62
|
-
ArrayBuffer [
|
|
63
|
-
255,
|
|
64
|
-
127,
|
|
65
|
-
]
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
exports[`st.s16(big) matches snapshots 1`] = `
|
|
69
|
-
ArrayBuffer [
|
|
70
|
-
0,
|
|
71
|
-
0,
|
|
72
|
-
]
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
exports[`st.s16(big) matches snapshots 2`] = `
|
|
76
|
-
ArrayBuffer [
|
|
77
|
-
128,
|
|
78
|
-
0,
|
|
79
|
-
]
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
exports[`st.s16(big) matches snapshots 3`] = `
|
|
83
|
-
ArrayBuffer [
|
|
84
|
-
128,
|
|
85
|
-
10,
|
|
86
|
-
]
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
exports[`st.s16(big) matches snapshots 4`] = `
|
|
90
|
-
ArrayBuffer [
|
|
91
|
-
127,
|
|
92
|
-
245,
|
|
93
|
-
]
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
exports[`st.s16(big) matches snapshots 5`] = `
|
|
97
|
-
ArrayBuffer [
|
|
98
|
-
127,
|
|
99
|
-
255,
|
|
100
|
-
]
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
exports[`st.s32(little) matches snapshots 1`] = `
|
|
104
|
-
ArrayBuffer [
|
|
105
|
-
0,
|
|
106
|
-
0,
|
|
107
|
-
0,
|
|
108
|
-
0,
|
|
109
|
-
]
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
exports[`st.s32(little) matches snapshots 2`] = `
|
|
113
|
-
ArrayBuffer [
|
|
114
|
-
0,
|
|
115
|
-
0,
|
|
116
|
-
0,
|
|
117
|
-
128,
|
|
118
|
-
]
|
|
119
|
-
`;
|
|
120
|
-
|
|
121
|
-
exports[`st.s32(little) matches snapshots 3`] = `
|
|
122
|
-
ArrayBuffer [
|
|
123
|
-
10,
|
|
124
|
-
0,
|
|
125
|
-
0,
|
|
126
|
-
128,
|
|
127
|
-
]
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
exports[`st.s32(little) matches snapshots 4`] = `
|
|
131
|
-
ArrayBuffer [
|
|
132
|
-
245,
|
|
133
|
-
255,
|
|
134
|
-
255,
|
|
135
|
-
127,
|
|
136
|
-
]
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
|
-
exports[`st.s32(little) matches snapshots 5`] = `
|
|
140
|
-
ArrayBuffer [
|
|
141
|
-
255,
|
|
142
|
-
255,
|
|
143
|
-
255,
|
|
144
|
-
127,
|
|
145
|
-
]
|
|
146
|
-
`;
|
|
147
|
-
|
|
148
|
-
exports[`st.s32(big) matches snapshots 1`] = `
|
|
149
|
-
ArrayBuffer [
|
|
150
|
-
0,
|
|
151
|
-
0,
|
|
152
|
-
0,
|
|
153
|
-
0,
|
|
154
|
-
]
|
|
155
|
-
`;
|
|
156
|
-
|
|
157
|
-
exports[`st.s32(big) matches snapshots 2`] = `
|
|
158
|
-
ArrayBuffer [
|
|
159
|
-
128,
|
|
160
|
-
0,
|
|
161
|
-
0,
|
|
162
|
-
0,
|
|
163
|
-
]
|
|
164
|
-
`;
|
|
165
|
-
|
|
166
|
-
exports[`st.s32(big) matches snapshots 3`] = `
|
|
167
|
-
ArrayBuffer [
|
|
168
|
-
128,
|
|
169
|
-
0,
|
|
170
|
-
0,
|
|
171
|
-
10,
|
|
172
|
-
]
|
|
173
|
-
`;
|
|
174
|
-
|
|
175
|
-
exports[`st.s32(big) matches snapshots 4`] = `
|
|
176
|
-
ArrayBuffer [
|
|
177
|
-
127,
|
|
178
|
-
255,
|
|
179
|
-
255,
|
|
180
|
-
245,
|
|
181
|
-
]
|
|
182
|
-
`;
|
|
183
|
-
|
|
184
|
-
exports[`st.s32(big) matches snapshots 5`] = `
|
|
185
|
-
ArrayBuffer [
|
|
186
|
-
127,
|
|
187
|
-
255,
|
|
188
|
-
255,
|
|
189
|
-
255,
|
|
190
|
-
]
|
|
191
|
-
`;
|
|
192
|
-
|
|
193
|
-
exports[`st.s64(little) matches snapshots 1`] = `
|
|
194
|
-
ArrayBuffer [
|
|
195
|
-
0,
|
|
196
|
-
0,
|
|
197
|
-
0,
|
|
198
|
-
0,
|
|
199
|
-
0,
|
|
200
|
-
0,
|
|
201
|
-
0,
|
|
202
|
-
0,
|
|
203
|
-
]
|
|
204
|
-
`;
|
|
205
|
-
|
|
206
|
-
exports[`st.s64(little) matches snapshots 2`] = `
|
|
207
|
-
ArrayBuffer [
|
|
208
|
-
0,
|
|
209
|
-
0,
|
|
210
|
-
0,
|
|
211
|
-
0,
|
|
212
|
-
0,
|
|
213
|
-
0,
|
|
214
|
-
0,
|
|
215
|
-
192,
|
|
216
|
-
]
|
|
217
|
-
`;
|
|
218
|
-
|
|
219
|
-
exports[`st.s64(little) matches snapshots 3`] = `
|
|
220
|
-
ArrayBuffer [
|
|
221
|
-
0,
|
|
222
|
-
0,
|
|
223
|
-
0,
|
|
224
|
-
0,
|
|
225
|
-
0,
|
|
226
|
-
0,
|
|
227
|
-
0,
|
|
228
|
-
192,
|
|
229
|
-
]
|
|
230
|
-
`;
|
|
231
|
-
|
|
232
|
-
exports[`st.s64(little) matches snapshots 4`] = `
|
|
233
|
-
ArrayBuffer [
|
|
234
|
-
0,
|
|
235
|
-
0,
|
|
236
|
-
0,
|
|
237
|
-
0,
|
|
238
|
-
0,
|
|
239
|
-
0,
|
|
240
|
-
0,
|
|
241
|
-
64,
|
|
242
|
-
]
|
|
243
|
-
`;
|
|
244
|
-
|
|
245
|
-
exports[`st.s64(little) matches snapshots 5`] = `
|
|
246
|
-
ArrayBuffer [
|
|
247
|
-
0,
|
|
248
|
-
0,
|
|
249
|
-
0,
|
|
250
|
-
0,
|
|
251
|
-
0,
|
|
252
|
-
0,
|
|
253
|
-
0,
|
|
254
|
-
64,
|
|
255
|
-
]
|
|
256
|
-
`;
|
|
257
|
-
|
|
258
|
-
exports[`st.s64(big) matches snapshots 1`] = `
|
|
259
|
-
ArrayBuffer [
|
|
260
|
-
0,
|
|
261
|
-
0,
|
|
262
|
-
0,
|
|
263
|
-
0,
|
|
264
|
-
0,
|
|
265
|
-
0,
|
|
266
|
-
0,
|
|
267
|
-
0,
|
|
268
|
-
]
|
|
269
|
-
`;
|
|
270
|
-
|
|
271
|
-
exports[`st.s64(big) matches snapshots 2`] = `
|
|
272
|
-
ArrayBuffer [
|
|
273
|
-
192,
|
|
274
|
-
0,
|
|
275
|
-
0,
|
|
276
|
-
0,
|
|
277
|
-
0,
|
|
278
|
-
0,
|
|
279
|
-
0,
|
|
280
|
-
0,
|
|
281
|
-
]
|
|
282
|
-
`;
|
|
283
|
-
|
|
284
|
-
exports[`st.s64(big) matches snapshots 3`] = `
|
|
285
|
-
ArrayBuffer [
|
|
286
|
-
192,
|
|
287
|
-
0,
|
|
288
|
-
0,
|
|
289
|
-
0,
|
|
290
|
-
0,
|
|
291
|
-
0,
|
|
292
|
-
0,
|
|
293
|
-
0,
|
|
294
|
-
]
|
|
295
|
-
`;
|
|
296
|
-
|
|
297
|
-
exports[`st.s64(big) matches snapshots 4`] = `
|
|
298
|
-
ArrayBuffer [
|
|
299
|
-
64,
|
|
300
|
-
0,
|
|
301
|
-
0,
|
|
302
|
-
0,
|
|
303
|
-
0,
|
|
304
|
-
0,
|
|
305
|
-
0,
|
|
306
|
-
0,
|
|
307
|
-
]
|
|
308
|
-
`;
|
|
309
|
-
|
|
310
|
-
exports[`st.s64(big) matches snapshots 5`] = `
|
|
311
|
-
ArrayBuffer [
|
|
312
|
-
64,
|
|
313
|
-
0,
|
|
314
|
-
0,
|
|
315
|
-
0,
|
|
316
|
-
0,
|
|
317
|
-
0,
|
|
318
|
-
0,
|
|
319
|
-
0,
|
|
320
|
-
]
|
|
321
|
-
`;
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
-
|
|
3
|
-
exports[`st.u8 matches snapshots 1`] = `
|
|
4
|
-
ArrayBuffer [
|
|
5
|
-
0,
|
|
6
|
-
]
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
exports[`st.u8 matches snapshots 2`] = `
|
|
10
|
-
ArrayBuffer [
|
|
11
|
-
0,
|
|
12
|
-
]
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`st.u8 matches snapshots 3`] = `
|
|
16
|
-
ArrayBuffer [
|
|
17
|
-
10,
|
|
18
|
-
]
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
exports[`st.u8 matches snapshots 4`] = `
|
|
22
|
-
ArrayBuffer [
|
|
23
|
-
245,
|
|
24
|
-
]
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`st.u8 matches snapshots 5`] = `
|
|
28
|
-
ArrayBuffer [
|
|
29
|
-
255,
|
|
30
|
-
]
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`st.u16(little) matches snapshots 1`] = `
|
|
34
|
-
ArrayBuffer [
|
|
35
|
-
0,
|
|
36
|
-
0,
|
|
37
|
-
]
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
exports[`st.u16(little) matches snapshots 2`] = `
|
|
41
|
-
ArrayBuffer [
|
|
42
|
-
0,
|
|
43
|
-
0,
|
|
44
|
-
]
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
exports[`st.u16(little) matches snapshots 3`] = `
|
|
48
|
-
ArrayBuffer [
|
|
49
|
-
10,
|
|
50
|
-
0,
|
|
51
|
-
]
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
exports[`st.u16(little) matches snapshots 4`] = `
|
|
55
|
-
ArrayBuffer [
|
|
56
|
-
245,
|
|
57
|
-
255,
|
|
58
|
-
]
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
exports[`st.u16(little) matches snapshots 5`] = `
|
|
62
|
-
ArrayBuffer [
|
|
63
|
-
255,
|
|
64
|
-
255,
|
|
65
|
-
]
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
exports[`st.u16(big) matches snapshots 1`] = `
|
|
69
|
-
ArrayBuffer [
|
|
70
|
-
0,
|
|
71
|
-
0,
|
|
72
|
-
]
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
exports[`st.u16(big) matches snapshots 2`] = `
|
|
76
|
-
ArrayBuffer [
|
|
77
|
-
0,
|
|
78
|
-
0,
|
|
79
|
-
]
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
exports[`st.u16(big) matches snapshots 3`] = `
|
|
83
|
-
ArrayBuffer [
|
|
84
|
-
0,
|
|
85
|
-
10,
|
|
86
|
-
]
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
exports[`st.u16(big) matches snapshots 4`] = `
|
|
90
|
-
ArrayBuffer [
|
|
91
|
-
255,
|
|
92
|
-
245,
|
|
93
|
-
]
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
exports[`st.u16(big) matches snapshots 5`] = `
|
|
97
|
-
ArrayBuffer [
|
|
98
|
-
255,
|
|
99
|
-
255,
|
|
100
|
-
]
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
exports[`st.u32(little) matches snapshots 1`] = `
|
|
104
|
-
ArrayBuffer [
|
|
105
|
-
0,
|
|
106
|
-
0,
|
|
107
|
-
0,
|
|
108
|
-
0,
|
|
109
|
-
]
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
exports[`st.u32(little) matches snapshots 2`] = `
|
|
113
|
-
ArrayBuffer [
|
|
114
|
-
0,
|
|
115
|
-
0,
|
|
116
|
-
0,
|
|
117
|
-
0,
|
|
118
|
-
]
|
|
119
|
-
`;
|
|
120
|
-
|
|
121
|
-
exports[`st.u32(little) matches snapshots 3`] = `
|
|
122
|
-
ArrayBuffer [
|
|
123
|
-
10,
|
|
124
|
-
0,
|
|
125
|
-
0,
|
|
126
|
-
0,
|
|
127
|
-
]
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
exports[`st.u32(little) matches snapshots 4`] = `
|
|
131
|
-
ArrayBuffer [
|
|
132
|
-
245,
|
|
133
|
-
255,
|
|
134
|
-
255,
|
|
135
|
-
255,
|
|
136
|
-
]
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
|
-
exports[`st.u32(little) matches snapshots 5`] = `
|
|
140
|
-
ArrayBuffer [
|
|
141
|
-
255,
|
|
142
|
-
255,
|
|
143
|
-
255,
|
|
144
|
-
255,
|
|
145
|
-
]
|
|
146
|
-
`;
|
|
147
|
-
|
|
148
|
-
exports[`st.u32(big) matches snapshots 1`] = `
|
|
149
|
-
ArrayBuffer [
|
|
150
|
-
0,
|
|
151
|
-
0,
|
|
152
|
-
0,
|
|
153
|
-
0,
|
|
154
|
-
]
|
|
155
|
-
`;
|
|
156
|
-
|
|
157
|
-
exports[`st.u32(big) matches snapshots 2`] = `
|
|
158
|
-
ArrayBuffer [
|
|
159
|
-
0,
|
|
160
|
-
0,
|
|
161
|
-
0,
|
|
162
|
-
0,
|
|
163
|
-
]
|
|
164
|
-
`;
|
|
165
|
-
|
|
166
|
-
exports[`st.u32(big) matches snapshots 3`] = `
|
|
167
|
-
ArrayBuffer [
|
|
168
|
-
0,
|
|
169
|
-
0,
|
|
170
|
-
0,
|
|
171
|
-
10,
|
|
172
|
-
]
|
|
173
|
-
`;
|
|
174
|
-
|
|
175
|
-
exports[`st.u32(big) matches snapshots 4`] = `
|
|
176
|
-
ArrayBuffer [
|
|
177
|
-
255,
|
|
178
|
-
255,
|
|
179
|
-
255,
|
|
180
|
-
245,
|
|
181
|
-
]
|
|
182
|
-
`;
|
|
183
|
-
|
|
184
|
-
exports[`st.u32(big) matches snapshots 5`] = `
|
|
185
|
-
ArrayBuffer [
|
|
186
|
-
255,
|
|
187
|
-
255,
|
|
188
|
-
255,
|
|
189
|
-
255,
|
|
190
|
-
]
|
|
191
|
-
`;
|
|
192
|
-
|
|
193
|
-
exports[`st.u64(little) matches snapshots 1`] = `
|
|
194
|
-
ArrayBuffer [
|
|
195
|
-
0,
|
|
196
|
-
0,
|
|
197
|
-
0,
|
|
198
|
-
0,
|
|
199
|
-
0,
|
|
200
|
-
0,
|
|
201
|
-
0,
|
|
202
|
-
0,
|
|
203
|
-
]
|
|
204
|
-
`;
|
|
205
|
-
|
|
206
|
-
exports[`st.u64(little) matches snapshots 2`] = `
|
|
207
|
-
ArrayBuffer [
|
|
208
|
-
0,
|
|
209
|
-
0,
|
|
210
|
-
0,
|
|
211
|
-
0,
|
|
212
|
-
0,
|
|
213
|
-
0,
|
|
214
|
-
0,
|
|
215
|
-
0,
|
|
216
|
-
]
|
|
217
|
-
`;
|
|
218
|
-
|
|
219
|
-
exports[`st.u64(little) matches snapshots 3`] = `
|
|
220
|
-
ArrayBuffer [
|
|
221
|
-
10,
|
|
222
|
-
0,
|
|
223
|
-
0,
|
|
224
|
-
0,
|
|
225
|
-
0,
|
|
226
|
-
0,
|
|
227
|
-
0,
|
|
228
|
-
0,
|
|
229
|
-
]
|
|
230
|
-
`;
|
|
231
|
-
|
|
232
|
-
exports[`st.u64(little) matches snapshots 4`] = `
|
|
233
|
-
ArrayBuffer [
|
|
234
|
-
0,
|
|
235
|
-
0,
|
|
236
|
-
0,
|
|
237
|
-
0,
|
|
238
|
-
0,
|
|
239
|
-
0,
|
|
240
|
-
0,
|
|
241
|
-
128,
|
|
242
|
-
]
|
|
243
|
-
`;
|
|
244
|
-
|
|
245
|
-
exports[`st.u64(little) matches snapshots 5`] = `
|
|
246
|
-
ArrayBuffer [
|
|
247
|
-
0,
|
|
248
|
-
0,
|
|
249
|
-
0,
|
|
250
|
-
0,
|
|
251
|
-
0,
|
|
252
|
-
0,
|
|
253
|
-
0,
|
|
254
|
-
128,
|
|
255
|
-
]
|
|
256
|
-
`;
|
|
257
|
-
|
|
258
|
-
exports[`st.u64(big) matches snapshots 1`] = `
|
|
259
|
-
ArrayBuffer [
|
|
260
|
-
0,
|
|
261
|
-
0,
|
|
262
|
-
0,
|
|
263
|
-
0,
|
|
264
|
-
0,
|
|
265
|
-
0,
|
|
266
|
-
0,
|
|
267
|
-
0,
|
|
268
|
-
]
|
|
269
|
-
`;
|
|
270
|
-
|
|
271
|
-
exports[`st.u64(big) matches snapshots 2`] = `
|
|
272
|
-
ArrayBuffer [
|
|
273
|
-
0,
|
|
274
|
-
0,
|
|
275
|
-
0,
|
|
276
|
-
0,
|
|
277
|
-
0,
|
|
278
|
-
0,
|
|
279
|
-
0,
|
|
280
|
-
0,
|
|
281
|
-
]
|
|
282
|
-
`;
|
|
283
|
-
|
|
284
|
-
exports[`st.u64(big) matches snapshots 3`] = `
|
|
285
|
-
ArrayBuffer [
|
|
286
|
-
0,
|
|
287
|
-
0,
|
|
288
|
-
0,
|
|
289
|
-
0,
|
|
290
|
-
0,
|
|
291
|
-
0,
|
|
292
|
-
0,
|
|
293
|
-
10,
|
|
294
|
-
]
|
|
295
|
-
`;
|
|
296
|
-
|
|
297
|
-
exports[`st.u64(big) matches snapshots 4`] = `
|
|
298
|
-
ArrayBuffer [
|
|
299
|
-
128,
|
|
300
|
-
0,
|
|
301
|
-
0,
|
|
302
|
-
0,
|
|
303
|
-
0,
|
|
304
|
-
0,
|
|
305
|
-
0,
|
|
306
|
-
0,
|
|
307
|
-
]
|
|
308
|
-
`;
|
|
309
|
-
|
|
310
|
-
exports[`st.u64(big) matches snapshots 5`] = `
|
|
311
|
-
ArrayBuffer [
|
|
312
|
-
128,
|
|
313
|
-
0,
|
|
314
|
-
0,
|
|
315
|
-
0,
|
|
316
|
-
0,
|
|
317
|
-
0,
|
|
318
|
-
0,
|
|
319
|
-
0,
|
|
320
|
-
]
|
|
321
|
-
`;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
//@ts-ignore TODO
|
|
2
|
-
import { describe, it, expect } from "bun:test";
|
|
3
|
-
import {
|
|
4
|
-
expectEncode,
|
|
5
|
-
expectEncodeSnapshot,
|
|
6
|
-
expectError,
|
|
7
|
-
randbigint,
|
|
8
|
-
randint,
|
|
9
|
-
} from "../utils.test";
|
|
10
|
-
|
|
11
|
-
import * as st from "../../index";
|
|
12
|
-
|
|
13
|
-
function test_bigint(options: {
|
|
14
|
-
name: string;
|
|
15
|
-
serializer: st.Serializer<bigint>;
|
|
16
|
-
range: [bigint, bigint];
|
|
17
|
-
size: number;
|
|
18
|
-
}) {
|
|
19
|
-
const {
|
|
20
|
-
name,
|
|
21
|
-
range: [start, end],
|
|
22
|
-
serializer,
|
|
23
|
-
size,
|
|
24
|
-
} = options;
|
|
25
|
-
describe(name, () => {
|
|
26
|
-
it("works in bounds", () => {
|
|
27
|
-
expectEncode(serializer, start);
|
|
28
|
-
for (let i = 0; i < 100; i++) {
|
|
29
|
-
expectEncode(serializer, randbigint(start, end));
|
|
30
|
-
}
|
|
31
|
-
expectEncode(serializer, end);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("outside bounds", () => {
|
|
35
|
-
expectError(() => st.write(serializer, start - 1n));
|
|
36
|
-
expectError(() => st.write(serializer, end + 1n));
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it(`is right size`, () => {
|
|
40
|
-
const expectValueSize = (value: bigint) => {
|
|
41
|
-
const data = st.write(serializer, value);
|
|
42
|
-
expect(data.byteLength).toBe(size);
|
|
43
|
-
};
|
|
44
|
-
for (let i = 0; i < 100; i++) {
|
|
45
|
-
expectValueSize(randbigint(start, end));
|
|
46
|
-
}
|
|
47
|
-
expectValueSize(start);
|
|
48
|
-
expectValueSize(end);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it(`matches snapshots`, () => {
|
|
52
|
-
expectEncodeSnapshot(serializer, 0n);
|
|
53
|
-
expectEncodeSnapshot(serializer, start);
|
|
54
|
-
expectEncodeSnapshot(serializer, start + 10n);
|
|
55
|
-
expectEncodeSnapshot(serializer, end - 10n);
|
|
56
|
-
expectEncodeSnapshot(serializer, end);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
test_bigint({
|
|
62
|
-
name: "st.u64(little)",
|
|
63
|
-
serializer: st.u64Bigint("little"),
|
|
64
|
-
range: [0n, 18_446_744_073_709_551_615n],
|
|
65
|
-
size: 8,
|
|
66
|
-
});
|
|
67
|
-
test_bigint({
|
|
68
|
-
name: "st.u64(big)",
|
|
69
|
-
serializer: st.u64Bigint("big"),
|
|
70
|
-
range: [0n, 18_446_744_073_709_551_615n],
|
|
71
|
-
size: 8,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test_bigint({
|
|
75
|
-
name: "st.s64(little)",
|
|
76
|
-
serializer: st.s64Bigint("little"),
|
|
77
|
-
range: [-9_223_372_036_854_775_808n, 9_223_372_036_854_775_807n],
|
|
78
|
-
size: 8,
|
|
79
|
-
});
|
|
80
|
-
test_bigint({
|
|
81
|
-
name: "st.s64(big)",
|
|
82
|
-
serializer: st.s64Bigint("big"),
|
|
83
|
-
range: [-9_223_372_036_854_775_808n, 9_223_372_036_854_775_807n],
|
|
84
|
-
size: 8,
|
|
85
|
-
});
|