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

Function TestReadHeaderStruct

leapsectz/leapsectz_test.go:300–323  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

298}
299
300func TestReadHeaderStruct(t *testing.T) {
301 byteData := []byte{
302 0x00, 0x00, 0x00, 0x01, // UTC/local
303 0x00, 0x00, 0x00, 0x02, // standard/wall
304 0x00, 0x00, 0x00, 0x03, // leap
305 0x00, 0x00, 0x00, 0x04, // transition
306 0x00, 0x00, 0x00, 0x05, // local tz
307 0x00, 0x00, 0x00, 0x06, // characters
308 0x04, 0xb2, 0x58, 0x00, // leap time
309 0x00, 0x00, 0x00, 0x01, // leap count
310 }
311
312 r := bytes.NewReader(byteData)
313
314 var hdr Header
315 err := binary.Read(r, binary.BigEndian, &hdr)
316 require.NoError(t, err)
317 require.Equal(t, uint32(6), hdr.CharCnt, "wrong header - CharCnt")
318 require.Equal(t, uint32(5), hdr.TypeCnt, "wrong header - TypeCnt")
319 require.Equal(t, uint32(4), hdr.TimeCnt, "wrong header - TimeCnt")
320 require.Equal(t, uint32(3), hdr.LeapCnt, "wrong header - LeapCnt")
321 require.Equal(t, uint32(2), hdr.IsStdCnt, "wrong header - IsStdCnt")
322 require.Equal(t, uint32(1), hdr.IsUtcCnt, "wrong header - IsUtcCnt")
323}
324
325func TestWriteV2(t *testing.T) {
326 byteData := []byte{

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…