(t *testing.T)
| 1083 | } |
| 1084 | |
| 1085 | func TestEncodeDecodeUBIGINTMax(t *testing.T) { |
| 1086 | // Max UBIGINT = 2^64 - 1 = 18446744073709551615 (20 digits) |
| 1087 | // DuckDB Go driver returns UBIGINT as duckdb.Decimal with scale 0 |
| 1088 | maxUBIGINT := new(big.Int) |
| 1089 | maxUBIGINT.SetString("18446744073709551615", 10) |
| 1090 | dec := duckdb.Decimal{Width: 20, Scale: 0, Value: maxUBIGINT} |
| 1091 | |
| 1092 | encoded := encodeNumeric(dec) |
| 1093 | if encoded == nil { |
| 1094 | t.Fatal("encodeNumeric returned nil for max UBIGINT") |
| 1095 | } |
| 1096 | |
| 1097 | decoded, err := decodeNumeric(encoded) |
| 1098 | if err != nil { |
| 1099 | t.Fatalf("decodeNumeric failed: %v", err) |
| 1100 | } |
| 1101 | if decoded != "18446744073709551615" { |
| 1102 | t.Errorf("roundtrip max UBIGINT = %q, want %q", decoded, "18446744073709551615") |
| 1103 | } |
| 1104 | } |
| 1105 | |
| 1106 | func TestDecodeNumericRaw(t *testing.T) { |
| 1107 | // Test decoding a manually constructed binary numeric: 99.99 |
nothing calls this directly
no test coverage detected