MCPcopy Create free account
hub / github.com/facebook/time / TestBitWriterBytePadding

Function TestBitWriterBytePadding

rtcm/bits_test.go:91–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestBitWriterBytePadding(t *testing.T) {
92 // 12 bits written -> 2 bytes, low 4 bits of the last byte are zero padding.
93 w := NewBitWriter(4)
94 w.WriteBits(0xABC, 12)
95 b := w.Bytes()
96 require.Len(t, b, 2)
97 require.Equal(t, byte(0xAB), b[0])
98 require.Equal(t, byte(0xC0), b[1]) // 0xC in high nibble, padding in low
99}
100
101func TestBitWriterEmpty(t *testing.T) {
102 w := NewBitWriter(0)

Callers

nothing calls this directly

Calls 4

WriteBitsMethod · 0.95
BytesMethod · 0.95
NewBitWriterFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…