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

Function roundtrip_all_fields

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

Source from the content-addressed store, hash-verified

501
502 #[test]
503 fn roundtrip_all_fields() {
504 let schema = crm_schema();
505 let encoder = TupleEncoder::new(&schema);
506 let decoder = TupleDecoder::new(&schema);
507
508 let values = vec![
509 Value::Integer(42),
510 Value::String("Alice".into()),
511 Value::String("alice@example.com".into()),
512 Value::Decimal(rust_decimal::Decimal::new(5000, 2)),
513 Value::Bool(true),
514 ];
515
516 let tuple = encoder.encode(&values).unwrap();
517 let decoded = decoder.extract_all(&tuple).unwrap();
518
519 assert_eq!(decoded[0], Value::Integer(42));
520 assert_eq!(decoded[1], Value::String("Alice".into()));
521 assert_eq!(decoded[2], Value::String("alice@example.com".into()));
522 assert_eq!(
523 decoded[3],
524 Value::Decimal(rust_decimal::Decimal::new(5000, 2))
525 );
526 assert_eq!(decoded[4], Value::Bool(true));
527 }
528
529 #[test]
530 fn roundtrip_with_nulls() {

Callers

nothing calls this directly

Calls 3

extract_allMethod · 0.80
crm_schemaFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected