MCPcopy
hub / github.com/rs/zerolog / TestAppendDurationInteger

Function TestAppendDurationInteger

internal/cbor/time_test.go:267–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

265 }
266}
267func TestAppendDurationInteger(t *testing.T) {
268 for _, tt := range internal.DurTestcases {
269 dur := tt.Duration
270 want := []byte{}
271 want = append(want, []byte(tt.IntegerOut)...)
272 got := enc.AppendDuration([]byte{}, dur, time.Microsecond, "", true, -1)
273 if !bytes.Equal(got, want) {
274 t.Errorf("AppendDuration(%v)=\ngot: 0x%s\nwant: 0x%s",
275 dur,
276 hex.EncodeToString(got),
277 hex.EncodeToString(want))
278 }
279 }
280}
281func TestAppendDurations(t *testing.T) {
282 array := make([]time.Duration, len(internal.DurTestcases))
283 want := make([]byte, 0)

Callers

nothing calls this directly

Calls 1

AppendDurationMethod · 0.65

Tested by

no test coverage detected