Skip to content

Commit

Permalink
Added test for logical duration
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Dec 19, 2021
1 parent 9f34f63 commit b4fb45a
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions tests/it/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde_json::Result;

use avro_schema::{BytesLogical, Field, LongLogical, Schema};
use avro_schema::*;

fn cases() -> Vec<(&'static str, Schema)> {
use Schema::*;
Expand Down Expand Up @@ -90,8 +90,17 @@ fn cases() -> Vec<(&'static str, Schema)> {
"type":["null", {"name":"MD5", "size":16, "type":"fixed"}]
},
{
"name":"meta",
"type":["null", {"type":"map", "values":"bytes"}]
"name": "meta",
"type": ["null", {"type": "map", "values":"bytes"}]
},
{
"name": "duration",
"type": {
"logicalType": "duration",
"name": "duration",
"type": "fixed",
"size": 12
}
}
]
}"#,
Expand All @@ -115,6 +124,18 @@ fn cases() -> Vec<(&'static str, Schema)> {
Union(vec![Null, avro_schema::Fixed::new("MD5", 16).into()]),
),
Field::new("meta", Union(vec![Null, Map(Box::new(Bytes(None)))])),
Field::new(
"duration",
avro_schema::Fixed {
name: "duration".to_string(),
size: 12,
namespace: None,
doc: None,
aliases: vec![],
logical: Some(FixedLogical::Duration),
}
.into(),
),
],
}),
),
Expand Down

0 comments on commit b4fb45a

Please sign in to comment.