Files
2026-05-27 23:29:53 +01:00

1.4 KiB

ADDED Requirements

Requirement: Strategies package provides all built-in packing strategies

The @suaveplan/bitpacker-strategies package SHALL provide PackingStrategy implementations for all schema tokens: number, string, boolean, null, bigint, object, array, enum, optional, oneOf, conditional, version, ref, datetime, varint, map, set, bitarray, blob, bitset.

Scenario: String strategy handles fixed and variable length

  • WHEN a schema is "8" (fixed) or "-8" (variable)
  • THEN the strategy packs and unpacks strings correctly for both formats

Scenario: Enum strategy packs index with minimum bits

  • WHEN a schema is { _enum: ["a", "b", "c"] }
  • THEN the packed value uses exactly 2 bits for the index

Scenario: Optional strategy uses presence bit

  • WHEN a schema is { _optional: 255 } and the value is undefined
  • THEN only a single 0 bit is written

Requirement: Strategies package exposes a default registration function

The @suaveplan/bitpacker-strategies package SHALL expose registerDefaultStrategies(manager) that adds all built-in strategies to a PackingStrategyManager in the correct order.

Scenario: Default strategies cover all primitive schemas

  • WHEN registerDefaultStrategies is called on a manager
  • THEN every primitive schema token has a matching strategy

MODIFIED Requirements

None.

REMOVED Requirements

None.