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

Function sidecar_roundtrip_binary

nodedb-vector/src/rerank/sidecar.rs:312–325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310
311 #[test]
312 fn sidecar_roundtrip_binary() {
313 use crate::rerank::codecs::BinaryRerank;
314 let dim = 16;
315 let mut s = CodecSidecar::new(Arc::new(BinaryRerank::new(dim)));
316 for i in 0..5u32 {
317 s.encode_and_insert(i, &det_vec(i as usize, dim)).unwrap();
318 }
319 let bytes = s.to_bytes().expect("to_bytes");
320 let s2 = CodecSidecar::from_bytes(&bytes).expect("from_bytes");
321 assert_eq!(s2.codec_name(), CodecName::Binary);
322 for i in 0..5u32 {
323 assert_eq!(s.get(i), s2.get(i), "encoded bytes differ for id {i}");
324 }
325 }
326
327 #[test]
328 fn sidecar_roundtrip_pq() {

Callers

nothing calls this directly

Calls 4

encode_and_insertMethod · 0.80
det_vecFunction · 0.70
expectMethod · 0.45
to_bytesMethod · 0.45

Tested by

no test coverage detected