use crate::v1_2::data_types::text::dv_text::DvText;
use crate::v1_2::demographic::address::Address;
impl Address {
#[must_use]
pub fn r#type(&self) -> &DvText {
&self.name
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::v1_2::data_structures::item_structure::item_structure::ItemStructure;
use crate::v1_2::data_structures::item_structure::item_tree::ItemTree;
use crate::v1_2::data_types::text::dv_text::DvTextData;
fn text(value: &str) -> DvText {
DvText::DvText(DvTextData {
value: value.to_owned(),
hyperlink: None,
formatting: None,
mappings: openehr_base::containers::present_nonempty(Vec::new()),
language: None,
encoding: None,
})
}
fn address(name: &str) -> Address {
Address {
name: text(name),
archetype_node_id: "openEHR-DEMOGRAPHIC-ADDRESS.address.v1".to_owned(),
uid: None,
links: None,
archetype_details: None,
feeder_audit: None,
details: ItemStructure::ItemTree(Box::new(ItemTree {
name: text("tree"),
archetype_node_id: "at0001".to_owned(),
uid: None,
links: None,
archetype_details: None,
feeder_audit: None,
items: None,
})),
}
}
#[test]
fn the_type_is_the_name() {
for name in ["electronic", "locality", ""] {
let address = address(name);
assert_eq!(address.r#type(), &address.name);
}
}
}