MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestFormatter_FloatFormat

Function TestFormatter_FloatFormat

formatter_test.go:604–715  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

602}
603
604func TestFormatter_FloatFormat(t *testing.T) {
605 cases := []struct {
606 name string
607 format FloatFormat
608 value interface{}
609 wantText string
610 }{
611 // float32
612 {
613 name: "float32 auto small exponent",
614 format: FloatFormatAuto,
615 value: float32(1.2345678),
616 wantText: "1.234_567_8",
617 },
618 {
619 name: "float32 auto large exponent",
620 format: FloatFormatAuto,
621 value: float32(1234567.8),
622 wantText: "1.234_567_8e+06",
623 },
624 {
625 name: "float32 decimal",
626 format: FloatFormatDecimal,
627 value: float32(1234567.8),
628 wantText: "1_234_567.8",
629 },
630 {
631 name: "float32 scientific",
632 format: FloatFormatScientific,
633 value: float32(1.2345678),
634 wantText: "1.234_567_8e+00",
635 },
636 // float64
637 {
638 name: "float64 auto small exponent",
639 format: FloatFormatAuto,
640 value: float64(1.23456789),
641 wantText: "1.234_567_89",
642 },
643 {
644 name: "float64 auto large exponent",
645 format: FloatFormatAuto,
646 value: float64(12345678.9),
647 wantText: "1.234_567_89e+07",
648 },
649 {
650 name: "float64 decimal",
651 format: FloatFormatDecimal,
652 value: float64(12345678.9),
653 wantText: "12_345_678.9",
654 },
655 {
656 name: "float64 scientific",
657 format: FloatFormatScientific,
658 value: float64(1.23456789),
659 wantText: "1.234_567_89e+00",
660 },
661 // no fractional part

Callers

nothing calls this directly

Calls 2

buildFormatDataMethod · 0.95
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…