(t *testing.T)
| 1104 | } |
| 1105 | |
| 1106 | func TestDecodeNumericRaw(t *testing.T) { |
| 1107 | // Test decoding a manually constructed binary numeric: 99.99 |
| 1108 | // ndigits=2, weight=0, sign=0x0000, dscale=2, digits=[99, 9900] |
| 1109 | data := make([]byte, 12) |
| 1110 | binary.BigEndian.PutUint16(data[0:], 2) // ndigits |
| 1111 | binary.BigEndian.PutUint16(data[2:], 0) // weight |
| 1112 | binary.BigEndian.PutUint16(data[4:], 0x0000) // sign (positive) |
| 1113 | binary.BigEndian.PutUint16(data[6:], 2) // dscale |
| 1114 | binary.BigEndian.PutUint16(data[8:], 99) // digit[0] |
| 1115 | binary.BigEndian.PutUint16(data[10:], 9900) // digit[1] |
| 1116 | |
| 1117 | result, err := decodeNumeric(data) |
| 1118 | if err != nil { |
| 1119 | t.Fatalf("decodeNumeric failed: %v", err) |
| 1120 | } |
| 1121 | if result != "99.99" { |
| 1122 | t.Errorf("decodeNumeric = %q, want %q", result, "99.99") |
| 1123 | } |
| 1124 | } |
| 1125 | |
| 1126 | func TestParseNumericTypmod(t *testing.T) { |
| 1127 | tests := []struct { |
nothing calls this directly
no test coverage detected