MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / raw_fixed_extraction

Function raw_fixed_extraction

nodedb-strict/src/decode.rs:711–733  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

709
710 #[test]
711 fn raw_fixed_extraction() {
712 let schema = StrictSchema::new(vec![
713 ColumnDef::required("a", ColumnType::Int64),
714 ColumnDef::required("b", ColumnType::Float64),
715 ColumnDef::required("c", ColumnType::Bool),
716 ])
717 .unwrap();
718 let encoder = TupleEncoder::new(&schema);
719 let decoder = TupleDecoder::new(&schema);
720
721 let tuple = encoder
722 .encode(&[Value::Integer(42), Value::Float(0.75), Value::Bool(true)])
723 .unwrap();
724
725 let a_raw = decoder.extract_fixed_raw(&tuple, 0).unwrap().unwrap();
726 assert_eq!(i64::from_le_bytes(a_raw.try_into().unwrap()), 42);
727
728 let b_raw = decoder.extract_fixed_raw(&tuple, 1).unwrap().unwrap();
729 assert_eq!(f64::from_le_bytes(b_raw.try_into().unwrap()), 0.75);
730
731 let c_raw = decoder.extract_fixed_raw(&tuple, 2).unwrap().unwrap();
732 assert_eq!(c_raw[0], 1);
733 }
734
735 #[test]
736 fn raw_variable_extraction() {

Callers

nothing calls this directly

Calls 2

extract_fixed_rawMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected