(t *testing.T)
| 715 | } |
| 716 | |
| 717 | func TestDecodeFloat8(t *testing.T) { |
| 718 | tests := []struct { |
| 719 | name string |
| 720 | input []byte |
| 721 | expected float64 |
| 722 | wantErr bool |
| 723 | }{ |
| 724 | {"3.14159", func() []byte { b := make([]byte, 8); binary.BigEndian.PutUint64(b, math.Float64bits(3.14159)); return b }(), 3.14159, false}, |
| 725 | {"zero", []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0, false}, |
| 726 | {"-1e100", func() []byte { b := make([]byte, 8); binary.BigEndian.PutUint64(b, math.Float64bits(-1e100)); return b }(), -1e100, false}, |
| 727 | {"insufficient data", []byte{0x00, 0x00, 0x00, 0x00}, 0, true}, |
| 728 | {"empty data", []byte{}, 0, true}, |
| 729 | } |
| 730 | |
| 731 | for _, tt := range tests { |
| 732 | t.Run(tt.name, func(t *testing.T) { |
| 733 | result, err := decodeFloat8(tt.input) |
| 734 | if tt.wantErr { |
| 735 | if err == nil { |
| 736 | t.Errorf("decodeFloat8(%v) expected error, got nil", tt.input) |
| 737 | } |
| 738 | return |
| 739 | } |
| 740 | if err != nil { |
| 741 | t.Errorf("decodeFloat8(%v) unexpected error: %v", tt.input, err) |
| 742 | return |
| 743 | } |
| 744 | if result != tt.expected { |
| 745 | t.Errorf("decodeFloat8(%v) = %f, want %f", tt.input, result, tt.expected) |
| 746 | } |
| 747 | }) |
| 748 | } |
| 749 | } |
| 750 | |
| 751 | func TestDecodeDate(t *testing.T) { |
| 752 | pgEpoch := time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC) |
nothing calls this directly
no test coverage detected