// AUTOGENERATED CODE -- DO NOT EDIT use std::convert::TryFrom; // AUTOGENERATED CODE -- DO NOT EDIT use std::fmt; // AUTOGENERATED CODE -- DO NOT EDIT use std::fmt::{Debug, Formatter}; // AUTOGENERATED CODE -- DO NOT EDIT use std::ops::{Deref, DerefMut}; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::node_wrappers::{debug_wrapper, FinalNode}; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::archetype::{ArchetypeTrait, AttributeArchetype}; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::form::{Form, FormTrait}; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::relation::attribute::{Attribute, AttributeTrait}; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::YIN_MAX_ID; /// The target of an implement command. #[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] // AUTOGENERATED CODE -- DO NOT EDIT pub struct Target { // AUTOGENERATED CODE -- DO NOT EDIT base: FinalNode, } // AUTOGENERATED CODE -- DO NOT EDIT impl Debug for Target { // AUTOGENERATED CODE -- DO NOT EDIT fn fmt(&self, f: &mut Formatter) -> fmt::Result { // AUTOGENERATED CODE -- DO NOT EDIT debug_wrapper("Target", self, f) } } // AUTOGENERATED CODE -- DO NOT EDIT impl From for Target { // AUTOGENERATED CODE -- DO NOT EDIT fn from(id: usize) -> Self { // AUTOGENERATED CODE -- DO NOT EDIT Self { // AUTOGENERATED CODE -- DO NOT EDIT base: FinalNode::from(id), } } } // AUTOGENERATED CODE -- DO NOT EDIT impl From for Target { // AUTOGENERATED CODE -- DO NOT EDIT fn from(f: FinalNode) -> Self { // AUTOGENERATED CODE -- DO NOT EDIT Self { base: f } } } // AUTOGENERATED CODE -- DO NOT EDIT impl<'a> TryFrom<&'a str> for Target { // AUTOGENERATED CODE -- DO NOT EDIT type Error = String; // AUTOGENERATED CODE -- DO NOT EDIT fn try_from(name: &'a str) -> Result { // AUTOGENERATED CODE -- DO NOT EDIT FinalNode::try_from(name).map(|f| Self { base: f }) } } // AUTOGENERATED CODE -- DO NOT EDIT impl Deref for Target { // AUTOGENERATED CODE -- DO NOT EDIT type Target = FinalNode; // AUTOGENERATED CODE -- DO NOT EDIT fn deref(&self) -> &Self::Target { // AUTOGENERATED CODE -- DO NOT EDIT &self.base } } // AUTOGENERATED CODE -- DO NOT EDIT impl DerefMut for Target { // AUTOGENERATED CODE -- DO NOT EDIT fn deref_mut(&mut self) -> &mut Self::Target { // AUTOGENERATED CODE -- DO NOT EDIT &mut self.base } } // AUTOGENERATED CODE -- DO NOT EDIT impl ArchetypeTrait for Target { // AUTOGENERATED CODE -- DO NOT EDIT type ArchetypeForm = AttributeArchetype; // AUTOGENERATED CODE -- DO NOT EDIT type Form = Target; // AUTOGENERATED CODE -- DO NOT EDIT const TYPE_ID: usize = YIN_MAX_ID + 1; // AUTOGENERATED CODE -- DO NOT EDIT const TYPE_NAME: &'static str = "target"; // AUTOGENERATED CODE -- DO NOT EDIT const PARENT_TYPE_ID: usize = Attribute::TYPE_ID; } // AUTOGENERATED CODE -- DO NOT EDIT impl FormTrait for Target {} // AUTOGENERATED CODE -- DO NOT EDIT impl AttributeTrait for Target { // AUTOGENERATED CODE -- DO NOT EDIT type OwnerForm = Form; // AUTOGENERATED CODE -- DO NOT EDIT type ValueForm = Form; } // AUTOGENERATED CODE -- DO NOT EDIT #[cfg(test)] // AUTOGENERATED CODE -- DO NOT EDIT mod tests { // AUTOGENERATED CODE -- DO NOT EDIT use super::*; // AUTOGENERATED CODE -- DO NOT EDIT use crate::tao::initialize_kb; // AUTOGENERATED CODE -- DO NOT EDIT use std::rc::Rc; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::node_wrappers::CommonNodeTrait; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::archetype::ArchetypeFormTrait; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::relation::attribute::{Owner, Value}; // AUTOGENERATED CODE -- DO NOT EDIT use zamm_yin::tao::Tao; // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn check_type_created() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(Target::archetype().id(), Target::TYPE_ID); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!( // AUTOGENERATED CODE -- DO NOT EDIT Target::archetype().internal_name(), // AUTOGENERATED CODE -- DO NOT EDIT Some(Rc::new(Target::TYPE_NAME.to_string())) ); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn check_type_attributes() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT #[rustfmt::skip] // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(Target::archetype().introduced_attribute_archetypes(), vec![]); // AUTOGENERATED CODE -- DO NOT EDIT #[rustfmt::skip] // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(Target::archetype().attribute_archetypes(), vec![Owner::archetype(), Value::archetype()]); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn from_node_id() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT let concept = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT let concept_copy = Target::from(concept.id()); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(concept.id(), concept_copy.id()); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn from_name() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT let mut concept = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT concept.set_internal_name("A".to_owned()); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(Target::try_from("A"), Ok(concept)); // AUTOGENERATED CODE -- DO NOT EDIT assert!(Target::try_from("B").is_err()); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn create_and_retrieve_node_id() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT let concept1 = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT let concept2 = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(concept1.id() + 1, concept2.id()); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn create_and_retrieve_node_name() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT let mut concept = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT concept.set_internal_name("A".to_string()); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(concept.internal_name(), Some(Rc::new("A".to_string()))); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn check_attribute_constraints() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!( // AUTOGENERATED CODE -- DO NOT EDIT Target::archetype().owner_archetype(), // AUTOGENERATED CODE -- DO NOT EDIT Tao::archetype().into() ); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!( // AUTOGENERATED CODE -- DO NOT EDIT Target::archetype().value_archetype(), // AUTOGENERATED CODE -- DO NOT EDIT Tao::archetype().into() ); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn get_owner() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT let mut instance = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT let owner_of_instance = Tao::new(); // AUTOGENERATED CODE -- DO NOT EDIT instance.set_owner(&owner_of_instance); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(instance.owner(), Some(owner_of_instance)); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(instance.value(), None); } // AUTOGENERATED CODE -- DO NOT EDIT #[test] // AUTOGENERATED CODE -- DO NOT EDIT fn get_value() { // AUTOGENERATED CODE -- DO NOT EDIT initialize_kb(); // AUTOGENERATED CODE -- DO NOT EDIT let mut instance = Target::new(); // AUTOGENERATED CODE -- DO NOT EDIT let value_of_instance = Tao::new(); // AUTOGENERATED CODE -- DO NOT EDIT instance.set_value(&value_of_instance); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(instance.owner(), None); // AUTOGENERATED CODE -- DO NOT EDIT assert_eq!(instance.value(), Some(value_of_instance)); } }