stash
This commit is contained in:
parent
8d96bc97c4
commit
ed04d98bf1
54 changed files with 661 additions and 1214 deletions
|
|
@ -46,9 +46,7 @@ test('rejects a 0 last-field value, for a multi-field kind', () => {
|
|||
|
||||
test('decoding never over-reads: a single-chunk field that exactly exhausts padding is not ' +
|
||||
'mistaken for a second field', () => {
|
||||
// category_id: 5 encodes as kind-tag(2 bits) + one 5-bit chunk = 7 bits, padded with exactly
|
||||
// 5 zero bits - the same 5 bits as a genuine one-chunk field of value 0. This is the concrete
|
||||
// case the last-field-nonzero rule exists to disambiguate.
|
||||
// category_id 5 -> 7 bits + 5 zero padding bits, identical to a genuine one-chunk zero field - the case the last-field-nonzero rule disambiguates.
|
||||
const token = encodeShortId([0, 5])
|
||||
expect(token).toBe('~Cg')
|
||||
expect(decodeShortId(token)).toEqual([0, 5])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue