# Specification coverage

A row is "tested" when an ExUnit example or a samtools comparison in this tree exercises that behaviour. "Partial" means the happy path and some malformed inputs are tested, and the gaps are named in `docs/compatibility.md`. Nothing here is a conformance certificate.

| Area | Status | Where it is checked |
| --- | --- | --- |
| Flag bits 0x1–0x800, unknown bits preserved | Tested | `BAM.Flags` doctests, `test/bam/stage0_test.exs` |
| CIGAR word codec and reference/query lengths | Tested | `BAM.Cigar` doctests |
| Zero-reference CIGAR counts as length 1 for binning and `end_pos` | Tested | `stage0_test.exs`, `BAM.Alignment` doctests |
| Sequence nybbles `=ACMGRSVTWYHKDBN` | Tested | `BAM.Sequence` doctests |
| `reg2bin` / `reg2bins` at level edges, including `2^29` | Tested | `BAM.Index.Bin` doctests |
| SAM region strings, including a single coordinate and a whole reference | Tested | `BAM.SAM.region/1` doctests |
| BGZF member, `BC`/`BSIZE`, CRC32, ISIZE, EOF block, truncated member, exact-size read | Tested | `test/bam/bgzf_test.exs` |
| Virtual offset pack and split | Tested | `BAM.BGZF` doctests |
| BAM magic, header text, reference dictionary, hostile `l_text` | Tested | `test/bam/round_trip_test.exs` |
| `BAM.info/1` does not read a later alignment member | Tested | counting source in `round_trip_test.exs` |
| Alignment core, CIGAR, sequence, quality, tags | Tested | round trip and samtools view |
| Record split across BGZF members | Tested | `round_trip_test.exs` |
| Strict raise and permissive `{:error, _}` when `block_size` is too small | Tested | `round_trip_test.exs` |
| Missing BGZF terminator | Tested | `round_trip_test.exs` |
| Stream laziness and early halt closes the source | Tested | tracking source in `round_trip_test.exs` |
| Reference and flag filters | Tested | `round_trip_test.exs` |
| Float tag raw bytes | Tested | `round_trip_test.exs` |
| BAI encode/decode and region edges | Tested | `index_query_test.exs`, `round_trip_test.exs`, samtools view |
| CSI encode/decode and a region query | Tested | `round_trip_test.exs` |
| Reference longer than 512 Mbp with only a BAI | Tested | `:needs_csi` in `index_query_test.exs` |
| Malformed index magic | Tested | `index_query_test.exs` |
| Unsorted index input | Tested | `round_trip_test.exs` |
| SAM parse and format | Tested | `round_trip_test.exs` |
| Writer output accepted by `samtools quickcheck` and `samtools view` | Tested on samtools 1.25 | `test/bam/samtools_test.exs` |
| Interval edges against `samtools view` | Tested on samtools 1.25 | `chr1:1-4`, `chr1:5-5`, `chr1:11-12`, `chr2` |
| Generated alignment round trip | Tested | `test/bam/fuzz_test.exs`, 20 runs |
| One-byte mutations do not crash past `%BAM.Error{}` | Tested | `fuzz_test.exs`, 25 runs |
| Long CIGAR `CG` tag | Unsupported | — |
| CRAM | Unsupported | — |
| Cloud or HTTP sources | Unsupported | — |
| Duplicate reference names | Unsupported | not rejected |
| Parallel BGZF inflate | Unsupported | not implemented |
| Full samtools command surface | Unsupported | only `view`, `index`, and `quickcheck` were used as oracles |
