MCPcopy Create free account
hub / github.com/apache/avro-rs / test_avro_3433_recursive_definition_encode_array

Function test_avro_3433_recursive_definition_encode_array

avro/src/encode.rs:457–502  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

455
456 #[test]
457 fn test_avro_3433_recursive_definition_encode_array() {
458 let mut buf = Vec::new();
459 let schema = Schema::parse_str(
460 r#"
461 {
462 "type":"record",
463 "name":"TestStruct",
464 "fields": [
465 {
466 "name":"a",
467 "type":{
468 "type":"array",
469 "items": {
470 "type":"record",
471 "name": "Inner",
472 "fields": [ {
473 "name":"z",
474 "type":"int"
475 }]
476 }
477 }
478 },
479 {
480 "name":"b",
481 "type": {
482 "type":"map",
483 "values":"Inner"
484 }
485 }
486 ]
487 }"#,
488 )
489 .unwrap();
490
491 let inner_value1 = Value::Record(vec![("z".into(), Value::Int(3))]);
492 let inner_value2 = Value::Record(vec![("z".into(), Value::Int(6))]);
493 let outer_value = Value::Record(vec![
494 ("a".into(), Value::Array(vec![inner_value1])),
495 (
496 "b".into(),
497 Value::Map(vec![("akey".into(), inner_value2)].into_iter().collect()),
498 ),
499 ]);
500 encode(&outer_value, &schema, &mut buf).expect(&success(&outer_value, &schema));
501 assert!(!buf.is_empty());
502 }
503
504 #[test]
505 fn test_avro_3433_recursive_definition_encode_map() {

Callers

nothing calls this directly

Calls 3

RecordClass · 0.85
encodeFunction · 0.85
successFunction · 0.85

Tested by

no test coverage detected