Skip to content

Commit 8a68b42

Browse files
committed
[tests] add extra assertions
These are mostly to make sure my understanding of how the library works is correct.
1 parent 536abdb commit 8a68b42

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/binary-data-test.dylan

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ end;
3434

3535
define test binary-data-parser ()
3636
let frame = parse-frame(<test-protocol>, #(#x23, #x42));
37+
assert-equal(frame.foo, #x23);
38+
assert-equal(frame.bar, #x42);
3739
let field-list = fields(frame);
3840
static-checker(field-list[0], 0, 8, 8);
3941
static-checker(field-list[1], 8, 8, 16);
@@ -62,6 +64,11 @@ end;
6264

6365
define test binary-data-dynamic-parser ()
6466
let frame = parse-frame(<dynamic-test>, #(#x2, #x0, #x0, #x3, #x4, #x5));
67+
assert-equal(frame.foobar, #x2);
68+
69+
// payload starts at foobar = 2 bytes into the frame so first 0 byte ignored.
70+
assert-equal(bd/data(frame.payload), #(#x0, #x3, #x4, #x5));
71+
6572
let field-list = fields(frame);
6673
static-checker(field-list[0], 0, 8, 8);
6774
static-checker(field-list[1], $unknown-at-compile-time, $unknown-at-compile-time, $unknown-at-compile-time);
@@ -87,6 +94,9 @@ end;
8794
define test static-start-test ()
8895
let frame = parse-frame(<static-start-frame>, #(#x3, #x4, #x5, #x6));
8996
let field-list = fields(frame);
97+
assert-equal(frame.a, #x3);
98+
// static-start at 24 bits means #x4 and #x5 are skipped.
99+
assert-equal(bd/data(frame.b), #(#x6));
90100
static-checker(field-list[0], 0, 8, 8);
91101
static-checker(field-list[1], 24, $unknown-at-compile-time, $unknown-at-compile-time);
92102
frame-field-checker(0, frame, 0, 8, 8);

0 commit comments

Comments
 (0)