Skip to content

Commit d11aa36

Browse files
committed
[tests] shortened lines > 90 chars
1 parent f4b3539 commit d11aa36

1 file changed

Lines changed: 64 additions & 26 deletions

File tree

tests/binary-data-test.dylan

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ define test binary-data-dynamic-parser ()
7676

7777
let field-list = fields(frame);
7878
static-checker(field-list[0], 0, 8, 8);
79-
static-checker(field-list[1], $unknown-at-compile-time, $unknown-at-compile-time, $unknown-at-compile-time);
79+
static-checker(field-list[1], $unknown-at-compile-time, $unknown-at-compile-time,
80+
$unknown-at-compile-time);
8081
frame-field-checker(0, frame, 0, 8, 8);
8182
frame-field-checker(1, frame, 16, 32, 48);
8283
end;
@@ -87,7 +88,8 @@ define test binary-data-dynamic-assemble ()
8788
payload: parse-frame(<raw-frame>, bv(#x23, #x42, #x23, #x42)));
8889
let byte-vector = assemble-frame(frame);
8990
check-equal("Assembling dynamic frame is correct (including padding)",
90-
as(<stretchy-byte-vector-subsequence>, #(#x3, #x0, #x0, #x23, #x42, #x23, #x42)),
91+
as(<stretchy-byte-vector-subsequence>,
92+
#(#x3, #x0, #x0, #x23, #x42, #x23, #x42)),
9193
byte-vector.packet);
9294
end;
9395

@@ -109,7 +111,9 @@ define test static-start-test ()
109111
end;
110112

111113
define test static-start-assemble ()
112-
let frame = make(<static-start-frame>, a: #x23, b: parse-frame(<raw-frame>, bv(#x2, #x3, #x4, #x5)));
114+
let frame = make(<static-start-frame>,
115+
a: #x23,
116+
b: parse-frame(<raw-frame>, bv(#x2, #x3, #x4, #x5)));
113117
let byte-vector = assemble-frame(frame);
114118
check-equal("Assembling static start frame is correct (including padding)",
115119
bv(#x23, #x0, #x0, #x2, #x3, #x4, #x5),
@@ -124,7 +128,8 @@ define binary-data <repeated-test-frame> (<container-frame>)
124128
end;
125129

126130
define test repeated-test ()
127-
let frame = parse-frame(<repeated-test-frame>, #(#x23, #x42, #x43, #x44, #x67, #x0, #x55));
131+
let frame = parse-frame(<repeated-test-frame>,
132+
#(#x23, #x42, #x43, #x44, #x67, #x0, #x55));
128133
let field-list = fields(frame);
129134
static-checker(field-list[0], 0, 8, 8);
130135
static-checker(field-list[1], 8, $unknown-at-compile-time, $unknown-at-compile-time);
@@ -147,7 +152,9 @@ end;
147152

148153
define binary-data <repeated-and-dynamic-test-frame> (<header-frame>)
149154
field header-length :: <unsigned-byte>,
150-
// FIXME: fixup: byte-offset(frame-size(frame.header-length) + frame-size(frame.type-code) + frame-size(frame.options));
155+
// FIXME: fixup: byte-offset(frame-size(frame.header-length)
156+
// + frame-size(frame.type-code)
157+
// + frame-size(frame.options));
151158
fixup: frame.options.size + 2;
152159
field type-code :: <unsigned-byte> = #x23;
153160
repeated field options :: <unsigned-byte>,
@@ -158,12 +165,14 @@ end;
158165

159166
define test repeated-and-dynamic-test ()
160167
let frame = parse-frame(<repeated-and-dynamic-test-frame>,
161-
#(#x8, #x23, #x42, #x43, #x44, #x45, #x46, #x47, #x80, #x81, #x82));
168+
#(#x8, #x23, #x42, #x43, #x44, #x45, #x46, #x47,
169+
#x80, #x81, #x82));
162170
let field-list = fields(frame);
163171
static-checker(field-list[0], 0, 8, 8);
164172
static-checker(field-list[1], 8, 8, 16);
165173
static-checker(field-list[2], 16, $unknown-at-compile-time, $unknown-at-compile-time);
166-
static-checker(field-list[3], $unknown-at-compile-time, $unknown-at-compile-time, $unknown-at-compile-time);
174+
static-checker(field-list[3], $unknown-at-compile-time, $unknown-at-compile-time,
175+
$unknown-at-compile-time);
167176
frame-field-checker(0, frame, 0, 8, 8);
168177
frame-field-checker(1, frame, 8, 8, 16);
169178
frame-field-checker(2, frame, 16, 48, 64);
@@ -172,7 +181,8 @@ end;
172181

173182
define test repeated-and-dynamic-test2 ()
174183
let frame = parse-frame(<repeated-and-dynamic-test-frame>,
175-
#(#x8, #x23, #x42, #x43, #x44, #x0, #x46, #x47, #x80, #x81, #x82));
184+
#(#x8, #x23, #x42, #x43, #x44, #x0, #x46, #x47,
185+
#x80, #x81, #x82));
176186
let field-list = fields(frame);
177187
frame-field-checker(0, frame, 0, 8, 8);
178188
frame-field-checker(1, frame, 8, 8, 16);
@@ -200,7 +210,8 @@ end;
200210

201211
define test count-repeated-test ()
202212
let frame = parse-frame(<count-repeated-test-frame>,
203-
#(#x3, #x23, #x42, #x43, #x44, #x0, #x46, #x47, #x80, #x81, #x82));
213+
#(#x3, #x23, #x42, #x43, #x44, #x0, #x46, #x47,
214+
#x80, #x81, #x82));
204215
let field-list = fields(frame);
205216
static-checker(field-list[0], 0, 8, 8);
206217
static-checker(field-list[1], 8, $unknown-at-compile-time, $unknown-at-compile-time);
@@ -236,7 +247,9 @@ define binary-data <labe> (<container-frame>)
236247
end;
237248

238249
define test label-test ()
239-
let frame = parse-frame(<labe>, #(#x23, #x42, #x01, #x02, #x42, #x03, #x33, #x33, #x33, #x42, #x00, #x42));
250+
let frame = parse-frame(<labe>,
251+
#(#x23, #x42, #x01, #x02, #x42, #x03, #x33, #x33,
252+
#x33, #x42, #x00, #x42));
240253
let field-list = fields(frame);
241254
static-checker(field-list[0], 0, 8, 8);
242255
static-checker(field-list[1], 8, $unknown-at-compile-time, $unknown-at-compile-time);
@@ -250,40 +263,52 @@ define test label-assemble ()
250263
let frames = as(<stretchy-vector>,
251264
list(make(<frag>, data: parse-frame(<raw-frame>, bv(#x1, #x2, #x3))),
252265
make(<frag>, data: parse-frame(<raw-frame>, bv(#x4, #x5, #x6))),
253-
make(<frag>, data: parse-frame(<raw-frame>, bv(#x7, #x8, #x9, #x10)))));
266+
make(<frag>, data: parse-frame(<raw-frame>,
267+
bv(#x7, #x8, #x9, #x10)))));
254268
let frame = make(<labe>, a: #x23, b: frames, c: #x42);
255269
let byte-vector = assemble-frame(frame);
256270
check-equal("label assemble",
257-
bv(#x23, #x23, #x3, #x1, #x2, #x3, #x23, #x3, #x4, #x5, #x6, #x23, #x4, #x7, #x8, #x9, #x10, #x42),
271+
bv(#x23, #x23, #x03, #x01, #x02, #x03, #x23, #x03,
272+
#x04, #x05, #x06, #x23, #x04, #x07, #x08, #x09,
273+
#x10, #x42),
258274
byte-vector.packet);
259275
end;
260276

261277
define test label-assign1 ()
262278
let frames = as(<stretchy-vector>,
263279
list(make(<frag>, data: parse-frame(<raw-frame>, bv(#x1, #x2, #x3))),
264280
make(<frag>, data: parse-frame(<raw-frame>, bv(#x4, #x5, #x6))),
265-
make(<frag>, data: parse-frame(<raw-frame>, bv(#x7, #x8, #x9, #x10)))));
281+
make(<frag>, data: parse-frame(<raw-frame>,
282+
bv(#x7, #x8, #x9, #x10)))));
266283
let frame = make(<labe>, a: #x23, b: frames, c: #x42);
267284
frame.b[1] := make(<frag>, data: parse-frame(<raw-frame>, bv(#x5, #x6, #x7)));
268285
let byte-vector = assemble-frame(frame);
269286
check-equal("label assign",
270-
bv(#x23, #x23, #x3, #x1, #x2, #x3, #x23, #x3, #x5, #x6, #x7, #x23, #x4, #x7, #x8, #x9, #x10, #x42),
287+
bv(#x23, #x23, #x03, #x01, #x02, #x03, #x23, #x03,
288+
#x05, #x06, #x07, #x23, #x04, #x07, #x08, #x09,
289+
#x10, #x42),
271290
byte-vector.packet);
272291
frames[0] := make(<frag>, data: parse-frame(<raw-frame>, bv(#x6, #x7, #x8)));
273292
byte-vector.b := frames;
274293
check-equal("label assign - 2",
275-
bv(#x23, #x23, #x3, #x6, #x7, #x8, #x23, #x3, #x5, #x6, #x7, #x23, #x4, #x7, #x8, #x9, #x10, #x42),
294+
bv(#x23, #x23, #x03, #x06, #x07, #x08, #x23, #x03,
295+
#x05, #x06, #x07, #x23, #x04, #x07, #x08, #x09,
296+
#x10, #x42),
276297
byte-vector.packet);
277298
let fr2 = make(<labe>, a: #x42, b: byte-vector.b, c: #x23);
278299
let bv2 = assemble-frame(fr2);
279300
check-equal("label assign - 3",
280-
bv(#x42, #x23, #x3, #x6, #x7, #x8, #x23, #x3, #x5, #x6, #x7, #x23, #x4, #x7, #x8, #x9, #x10, #x23),
301+
bv(#x42, #x23, #x03, #x06, #x07, #x08, #x23, #x03,
302+
#x05, #x06, #x07, #x23, #x04, #x07, #x08, #x09,
303+
#x10, #x23),
281304
bv2.packet);
282305
frames[0] := make(<frag>, data: parse-frame(<raw-frame>, bv(#x10, #x11, #x12)));
283306
bv2.b := frames;
284307
frame-field-checker(1, bv2, 8, 128, 136);
285308
check-equal("label assign - 4",
286-
bv(#x42, #x23, #x3, #x10, #x11, #x12, #x23, #x3, #x5, #x6, #x7, #x23, #x4, #x7, #x8, #x9, #x10, #x23),
309+
bv(#x42, #x23, #x03, #x10, #x11, #x12, #x23, #x03,
310+
#x05, #x06, #x07, #x23, #x04, #x07, #x08, #x09,
311+
#x10, #x23),
287312
bv2.packet);
288313
end;
289314

@@ -319,7 +344,10 @@ end;
319344
*/
320345

321346
define test label-assign3 ()
322-
let fr = parse-frame(<labe>, bv(#x42, #x23, #x2, #x10, #x11, #x23, #x3, #x4, #x5, #x6, #x23, #x4, #x7, #x8, #x9, #x10, #x23, #x00, #x23));
347+
let fr = parse-frame(<labe>,
348+
bv(#x42, #x23, #x02, #x10, #x11, #x23, #x03, #x04,
349+
#x05, #x06, #x23, #x04, #x07, #x08, #x09, #x10,
350+
#x23, #x00, #x23));
323351
frame-field-checker(0, fr, 0, 8, 8);
324352
frame-field-checker(1, fr, 8, 136, 144);
325353
frame-field-checker(2, fr, 144, 8, 152);
@@ -329,9 +357,11 @@ define test label-assign3 ()
329357
check-equal("b is of size 4", 4, size(fr.b));
330358
check-true("all of b are <frag>", every?(rcurry(instance?, <frag>), fr.b));
331359
check-true("frame-size of b is 136", reduce1(\+, map(frame-size, fr.b)));
332-
check-true("all of b are <unparsed-frag>", every?(rcurry(instance?, <unparsed-frag>), fr.b));
360+
check-true("all of b are <unparsed-frag>",
361+
every?(rcurry(instance?, <unparsed-frag>), fr.b));
333362
check-true("fr is an <unparsed-labe>", instance?(fr, <unparsed-labe>));
334-
check-equal("sizes of bs are correct", as(<stretchy-vector>, #(32, 40, 48, 16)), map(frame-size, fr.b));
363+
check-equal("sizes of bs are correct",
364+
as(<stretchy-vector>, #(32, 40, 48, 16)), map(frame-size, fr.b));
335365
let res = labe(a: fr.a, b: fr.b, c: fr.c);
336366
frame-field-checker(0, res, 0, 8, 8);
337367
frame-field-checker(1, res, 8, 136, 144);
@@ -342,7 +372,9 @@ define test label-assign3 ()
342372
frame-field-checker(2, bytes, 144, 8, 152);
343373
check-equal("size of bytes is correct", 19, bytes.packet.size);
344374
check-equal("label assign3",
345-
bv(#x42, #x23, #x2, #x10, #x11, #x23, #x3, #x4, #x5, #x6, #x23, #x4, #x7, #x8, #x9, #x10, #x23, #x00, #x23),
375+
bv(#x42, #x23, #x02, #x10, #x11, #x23, #x03, #x04,
376+
#x05, #x06, #x23, #x04, #x07, #x08, #x09, #x10,
377+
#x23, #x00, #x23),
346378
bytes.packet);
347379
end;
348380

@@ -422,7 +454,9 @@ define test dynamic-length ()
422454
end;
423455

424456
define test inheritance-dynamic-length-assemble ()
425-
let frame = make(<b-sub>, type-code: #x42, data: parse-frame(<raw-frame>, bv(#x23, #x42, #x23, #x42)));
457+
let frame = make(<b-sub>,
458+
type-code: #x42,
459+
data: parse-frame(<raw-frame>, bv(#x23, #x42, #x23, #x42)));
426460
let byte-vector = assemble-frame(frame);
427461
check-equal("Inheritance dynamic length assemble",
428462
bv(#x42, #x4, #x23, #x42, #x23, #x42),
@@ -534,14 +568,16 @@ end;
534568

535569
define test dynlength ()
536570
let f = parse-frame(<dyn-length-in-container>, #(#x00, #x02));
537-
check-equal("length frame.my-length; size of simple frame is correct", 16, f.frame-size);
571+
check-equal("length frame.my-length; size of simple frame is correct",
572+
16, f.frame-size);
538573
let field-list = fields(f);
539574
static-checker(field-list[0], 0, 8, 8);
540575
static-checker(field-list[1], 8, 8, 16);
541576
frame-field-checker(0, f, 0, 8, 8);
542577
frame-field-checker(1, f, 8, 8, 16);
543578
let g = parse-frame(<dyn-length-in-container>, #(#x00, #x03, #x02));
544-
check-equal("length frame.my-length; size of frame with padding is correct", 24, g.frame-size);
579+
check-equal("length frame.my-length; size of frame with padding is correct",
580+
24, g.frame-size);
545581
frame-field-checker(0, g, 0, 8, 8);
546582
frame-field-checker(1, g, 8, 8, 16);
547583
//this tells us: we need padding frame fields!
@@ -570,13 +606,15 @@ define test dyn-length-client ()
570606
check-equal("size of dyn-length-client is correct", 32, f.frame-size);
571607
let field-list = fields(f);
572608
static-checker(field-list[0], 0, $unknown-at-compile-time, $unknown-at-compile-time);
573-
static-checker(field-list[1], $unknown-at-compile-time, $unknown-at-compile-time, $unknown-at-compile-time);
609+
static-checker(field-list[1], $unknown-at-compile-time, $unknown-at-compile-time,
610+
$unknown-at-compile-time);
574611
frame-field-checker(0, f, 0, 16, 16);
575612
frame-field-checker(1, f, 16, 16, 32);
576613
end;
577614

578615
define test dyn-length-client2 ()
579-
let f = parse-frame(<dyn-length-as-client-field>, #(#x00, #x03, #x04, #x00, #x04, #x01, #x02));
616+
let f = parse-frame(<dyn-length-as-client-field>,
617+
#(#x00, #x03, #x04, #x00, #x04, #x01, #x02));
580618
check-equal("size of dyn-length-client2 is correct", 56, f.frame-size);
581619
frame-field-checker(0, f, 0, 24, 24);
582620
frame-field-checker(1, f, 24, 32, 56);

0 commit comments

Comments
 (0)