(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func TestAppendDurationFloat(t *testing.T) { |
| 279 | for _, tt := range internal.DurTestcases { |
| 280 | dur := tt.Duration |
| 281 | want := []byte{} |
| 282 | want = append(want, []byte(fmt.Sprintf("%v", dur.Microseconds()))...) |
| 283 | got := enc.AppendDuration([]byte{}, dur, time.Microsecond, "", false, -1) |
| 284 | if !bytes.Equal(got, want) { |
| 285 | t.Errorf("AppendDuration(%v)=\ngot: %s\nwant: %s", |
| 286 | dur, |
| 287 | string(got), |
| 288 | string(want)) |
| 289 | } |
| 290 | |
| 291 | want = []byte{} |
| 292 | fraction := float64(dur) / float64(time.Millisecond) |
| 293 | want = append(want, []byte(fmt.Sprintf("%v", fraction))...) |
| 294 | got = enc.AppendDuration([]byte{}, dur, time.Millisecond, "", false, -1) |
| 295 | if !bytes.Equal(got, want) { |
| 296 | t.Errorf("AppendDuration(%v)=\ngot: %s\nwant: %s", |
| 297 | dur, |
| 298 | string(got), |
| 299 | string(want)) |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | func TestAppendDurationInteger(t *testing.T) { |
| 304 | for _, tt := range internal.DurTestcases { |
| 305 | dur := tt.Duration |
nothing calls this directly
no test coverage detected