MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / inner

Function inner

src/pgrepr/src/value/numeric.rs:262–273  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

260#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `decContextDefault` on OS `linux`
261fn test_to_from_sql_roundtrip() {
262 fn inner(s: &str) {
263 let mut cx = numeric::cx_datum();
264 let d = cx.parse(s).unwrap();
265 let r = Numeric(OrderedDecimal(d));
266
267 let mut out = BytesMut::new();
268
269 let _ = r.to_sql(&Type::NUMERIC, &mut out).unwrap();
270
271 let d_from_sql = Numeric::from_sql(&Type::NUMERIC, &out).unwrap();
272 assert_eq!(r.0, d_from_sql.0);
273 }
274 inner("0");
275 inner("-0");
276 inner("0.1");

Callers 1

Calls 5

cx_datumFunction · 0.85
unwrapMethod · 0.80
NumericClass · 0.70
parseMethod · 0.45
to_sqlMethod · 0.45

Tested by 1