@@ -16,7 +16,7 @@ func TestBundleBytes(t *testing.T) {
16
16
Input : Bundle {Timetag : 10 },
17
17
Output : bytes .Join ([][]byte {
18
18
ToBytes (BundleTag ),
19
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A },
19
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A },
20
20
}, []byte {}),
21
21
},
22
22
{
@@ -34,12 +34,12 @@ func TestBundleBytes(t *testing.T) {
34
34
},
35
35
Output : bytes .Join ([][]byte {
36
36
ToBytes (BundleTag ),
37
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A },
38
- [] byte {0 , 0 , 0 , 0x14 },
39
- [] byte {'/' , 'f' , 'o' , 'o' , 0 , 0 , 0 , 0 },
40
- [] byte {',' , TypetagInt , TypetagFloat , 0 },
41
- [] byte {0 , 0 , 0 , 2 },
42
- [] byte {0x40 , 0xA7 , 0x67 , 0xA1 },
37
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A },
38
+ {0 , 0 , 0 , 0x14 },
39
+ {'/' , 'f' , 'o' , 'o' , 0 , 0 , 0 , 0 },
40
+ {',' , TypetagInt , TypetagFloat , 0 },
41
+ {0 , 0 , 0 , 2 },
42
+ {0x40 , 0xA7 , 0x67 , 0xA1 },
43
43
}, []byte {}),
44
44
},
45
45
// Bundle within a bundle.
@@ -69,19 +69,19 @@ func TestBundleBytes(t *testing.T) {
69
69
},
70
70
Output : bytes .Join ([][]byte {
71
71
ToBytes (BundleTag ),
72
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A }, // Timetag
73
- [] byte {0 , 0 , 0 , 0x24 }, // Length of first bundle element
72
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A }, // Timetag
73
+ {0 , 0 , 0 , 0x24 }, // Length of first bundle element
74
74
ToBytes (BundleTag ),
75
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x14 }, // Timetag
76
- [] byte {0 , 0 , 0 , 0x10 }, // Length of first element of bundle within bundle.
77
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
78
- [] byte {TypetagPrefix , TypetagFloat , 0 , 0 },
79
- [] byte {0x3F , 0x80 , 0x00 , 0x00 },
80
- [] byte {0 , 0 , 0 , 0x14 }, // Length of second bundle element
81
- [] byte {'/' , 'f' , 'o' , 'o' , 0 , 0 , 0 , 0 },
82
- [] byte {TypetagPrefix , TypetagInt , TypetagFloat , 0 },
83
- [] byte {0 , 0 , 0 , 2 },
84
- [] byte {0x40 , 0xA7 , 0x67 , 0xA1 },
75
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x14 }, // Timetag
76
+ {0 , 0 , 0 , 0x10 }, // Length of first element of bundle within bundle.
77
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
78
+ {TypetagPrefix , TypetagFloat , 0 , 0 },
79
+ {0x3F , 0x80 , 0x00 , 0x00 },
80
+ {0 , 0 , 0 , 0x14 }, // Length of second bundle element
81
+ {'/' , 'f' , 'o' , 'o' , 0 , 0 , 0 , 0 },
82
+ {TypetagPrefix , TypetagInt , TypetagFloat , 0 },
83
+ {0 , 0 , 0 , 2 },
84
+ {0x40 , 0xA7 , 0x67 , 0xA1 },
85
85
}, []byte {}),
86
86
},
87
87
} {
@@ -172,7 +172,7 @@ func TestParseBundle(t *testing.T) {
172
172
Input : bytes .Join (
173
173
[][]byte {
174
174
append ([]byte ("#bundle" ), 0 ),
175
- [] byte {1 , 2 , 3 , 4 , 5 , 6 , 7 },
175
+ {1 , 2 , 3 , 4 , 5 , 6 , 7 },
176
176
},
177
177
[]byte {},
178
178
),
@@ -185,9 +185,9 @@ func TestParseBundle(t *testing.T) {
185
185
Input : bytes .Join (
186
186
[][]byte {
187
187
append ([]byte ("#bundle" ), 0 ),
188
- [] byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 },
189
- [] byte {0 , 0 , 0 , 4 },
190
- [] byte {'%' , 'n' , 'o' , 0 },
188
+ {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 },
189
+ {0 , 0 , 0 , 4 },
190
+ {'%' , 'n' , 'o' , 0 },
191
191
},
192
192
[]byte {},
193
193
),
@@ -201,10 +201,10 @@ func TestParseBundle(t *testing.T) {
201
201
[][]byte {
202
202
append ([]byte ("#bundle" ), 0 ),
203
203
Timetag (50 ).Bytes (),
204
- [] byte {0 , 0 , 0 , 0x10 },
205
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
206
- [] byte {TypetagPrefix , TypetagInt , 0 , 0 },
207
- [] byte {0 , 0 , 0 , 7 },
204
+ {0 , 0 , 0 , 0x10 },
205
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
206
+ {TypetagPrefix , TypetagInt , 0 , 0 },
207
+ {0 , 0 , 0 , 7 },
208
208
},
209
209
[]byte {},
210
210
),
@@ -226,7 +226,7 @@ func TestParseBundle(t *testing.T) {
226
226
[][]byte {
227
227
append ([]byte ("#bundle" ), 0 ),
228
228
Timetag (50 ).Bytes (),
229
- [] byte {0 , 0 , 0x10 },
229
+ {0 , 0 , 0x10 },
230
230
},
231
231
[]byte {},
232
232
),
@@ -240,10 +240,10 @@ func TestParseBundle(t *testing.T) {
240
240
[][]byte {
241
241
append ([]byte ("#bundle" ), 0 ),
242
242
Timetag (50 ).Bytes (),
243
- [] byte {0 , 0 , 0 , 0x20 },
244
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
245
- [] byte {TypetagPrefix , TypetagInt , 0 , 0 },
246
- [] byte {0 , 0 , 0 , 7 },
243
+ {0 , 0 , 0 , 0x20 },
244
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
245
+ {TypetagPrefix , TypetagInt , 0 , 0 },
246
+ {0 , 0 , 0 , 7 },
247
247
},
248
248
[]byte {},
249
249
),
@@ -257,14 +257,14 @@ func TestParseBundle(t *testing.T) {
257
257
[][]byte {
258
258
append ([]byte ("#bundle" ), 0 ),
259
259
Timetag (50 ).Bytes (),
260
- [] byte {0 , 0 , 0 , 0x10 },
261
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
262
- [] byte {TypetagPrefix , TypetagInt , 0 , 0 },
263
- [] byte {0 , 0 , 0 , 7 },
264
- [] byte {0 , 0 , 0 , 0x10 },
265
- [] byte {'/' , 'b' , 'o' , 'r' , 'k' , 0 , 0 , 0 },
266
- [] byte {TypetagPrefix , TypetagFloat , 0 , 0 },
267
- [] byte {0x40 , 0x48 , 0xf5 , 0xc3 },
260
+ {0 , 0 , 0 , 0x10 },
261
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
262
+ {TypetagPrefix , TypetagInt , 0 , 0 },
263
+ {0 , 0 , 0 , 7 },
264
+ {0 , 0 , 0 , 0x10 },
265
+ {'/' , 'b' , 'o' , 'r' , 'k' , 0 , 0 , 0 },
266
+ {TypetagPrefix , TypetagFloat , 0 , 0 },
267
+ {0x40 , 0x48 , 0xf5 , 0xc3 },
268
268
},
269
269
[]byte {},
270
270
),
@@ -290,10 +290,10 @@ func TestParseBundle(t *testing.T) {
290
290
[][]byte {
291
291
append ([]byte ("#bundle" ), 0 ),
292
292
Timetag (50 ).Bytes (),
293
- [] byte {0 , 0 , 0 , 0x10 },
294
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
295
- [] byte {TypetagPrefix , TypetagInt , 'Q' , 0 },
296
- [] byte {0 , 0 , 0 , 7 },
293
+ {0 , 0 , 0 , 0x10 },
294
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
295
+ {TypetagPrefix , TypetagInt , 'Q' , 0 },
296
+ {0 , 0 , 0 , 7 },
297
297
},
298
298
[]byte {},
299
299
),
@@ -305,22 +305,22 @@ func TestParseBundle(t *testing.T) {
305
305
{
306
306
Input : bytes .Join ([][]byte {
307
307
ToBytes (BundleTag ),
308
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A }, // Timetag
309
- [] byte {0 , 0 , 0 , 0x24 }, // Length of first bundle element
308
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A }, // Timetag
309
+ {0 , 0 , 0 , 0x24 }, // Length of first bundle element
310
310
ToBytes (BundleTag ),
311
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x14 }, // Timetag
312
- [] byte {0 , 0 , 0 , 0x10 }, // Length of first element of bundle within bundle.
313
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
314
- [] byte {TypetagPrefix , TypetagFloat , 0 , 0 },
315
- [] byte {0x3F , 0x80 , 0x00 , 0x00 },
316
- [] byte {0 , 0 , 0 , 0x14 }, // Length of second bundle element
317
- [] byte {'/' , 'f' , 'o' , 'o' , 0 , 0 , 0 , 0 },
318
- [] byte {TypetagPrefix , TypetagInt , TypetagFloat , 0 },
319
- [] byte {0 , 0 , 0 , 2 },
320
- [] byte {0x40 , 0xA7 , 0x67 , 0xA1 },
321
- [] byte {0 , 0 , 0 , 0x10 }, // Length of third bundleelement
311
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x14 }, // Timetag
312
+ {0 , 0 , 0 , 0x10 }, // Length of first element of bundle within bundle.
313
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
314
+ {TypetagPrefix , TypetagFloat , 0 , 0 },
315
+ {0x3F , 0x80 , 0x00 , 0x00 },
316
+ {0 , 0 , 0 , 0x14 }, // Length of second bundle element
317
+ {'/' , 'f' , 'o' , 'o' , 0 , 0 , 0 , 0 },
318
+ {TypetagPrefix , TypetagInt , TypetagFloat , 0 },
319
+ {0 , 0 , 0 , 2 },
320
+ {0x40 , 0xA7 , 0x67 , 0xA1 },
321
+ {0 , 0 , 0 , 0x10 }, // Length of third bundleelement
322
322
ToBytes (BundleTag ),
323
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x28 }, // Timetag
323
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x28 }, // Timetag
324
324
}, []byte {}),
325
325
Expected : Output {
326
326
bundle : Bundle {
@@ -353,14 +353,14 @@ func TestParseBundle(t *testing.T) {
353
353
{
354
354
Input : bytes .Join ([][]byte {
355
355
ToBytes (BundleTag ),
356
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A }, // Timetag
357
- [] byte {0 , 0 , 0 , 0x24 }, // Length of first bundle element
356
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x0A }, // Timetag
357
+ {0 , 0 , 0 , 0x24 }, // Length of first bundle element
358
358
ToBytes (BundleTag ),
359
- [] byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x14 }, // Timetag
360
- [] byte {0 , 0 , 0 , 0x10 }, // Length of first element of bundle within bundle.
361
- [] byte {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
362
- [] byte {TypetagPrefix , 'Q' , 0 , 0 },
363
- [] byte {0x3F , 0x80 , 0x00 , 0x00 },
359
+ {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x14 }, // Timetag
360
+ {0 , 0 , 0 , 0x10 }, // Length of first element of bundle within bundle.
361
+ {'/' , 'f' , 'o' , 'o' , 'b' , 'a' , 'r' , 0 },
362
+ {TypetagPrefix , 'Q' , 0 , 0 },
363
+ {0x3F , 0x80 , 0x00 , 0x00 },
364
364
}, []byte {}),
365
365
Expected : Output {
366
366
err : errors .New (`read packets: read packet: parse bundle from packet: read packets: read packet: parse message from packet: parse message: read argument 0: typetag "Q": invalid type tag` ),
0 commit comments