Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/unreleased/1596.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `asn.1`: adds proof coverage for `parsedTagDecode`'s tag class ×
primitive/constructed combinations, bringing the module to 100%
line/branch/function coverage
16 changes: 16 additions & 0 deletions fjs/asn.1/proof.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,22 @@ export const proof = {
// Re-encoding an UnsupportedRecord returns it unchanged (it is already the TLV bytes)
assertEq(encode(decoded), raw, 'encode should round-trip UnsupportedRecord')
},
// parsedTagDecode narrows the top three bits of the tag's first byte
// (class + primitive/constructed) to one of exactly eight values via an
// 8-way `||` assert. Every other test in this file only ever exercises
// the universal-primitive tag (top bits 000), so each of the other seven
// comparisons has never had a case where it's the one that turns the
// assert true — one round trip per class×P/C combination covers them all.
tagClass: {
universalPrimitive: () => check(0x02n, vec8(0x42n), empty),
universalConstructed: () => check(0x22n, vec8(0x42n), empty),
applicationPrimitive: () => check(0x42n, vec8(0x42n), empty),
applicationConstructed: () => check(0x62n, vec8(0x42n), empty),
contextPrimitive: () => check(0x82n, vec8(0x42n), empty),
contextConstructed: () => check(0xA2n, vec8(0x42n), empty),
privatePrimitive: () => check(0xC2n, vec8(0x42n), empty),
privateConstructed: () => check(0xE2n, vec8(0x42n), empty),
},
raw: [
() => {
const e = encodeRaw([0x00n, vec8(0x23n)])
Expand Down
Loading