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

Function build_and_lookup

nodedb-query/src/msgpack_scan/index.rs:128–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126
127 #[test]
128 fn build_and_lookup() {
129 let buf = encode(&json!({"name": "alice", "age": 30, "score": 99.5}));
130 let idx = FieldIndex::build(&buf, 0).unwrap();
131
132 assert_eq!(idx.len(), 3);
133
134 let (s, _) = idx.get("name").unwrap();
135 assert_eq!(read_str(&buf, s), Some("alice"));
136
137 let (s, _) = idx.get("age").unwrap();
138 assert_eq!(read_i64(&buf, s), Some(30));
139
140 let (s, _) = idx.get("score").unwrap();
141 assert_eq!(read_f64(&buf, s), Some(99.5));
142 }
143
144 #[test]
145 fn missing_field() {

Callers

nothing calls this directly

Calls 2

encodeFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected