|
|
|
@ -135,3 +135,27 @@ impl Flags { |
|
|
|
|
value | flags.bits() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[cfg(test)] |
|
|
|
|
mod tests { |
|
|
|
|
use super::*; |
|
|
|
|
|
|
|
|
|
use super::super::entity::Entity; |
|
|
|
|
use super::super::relation::Relation; |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn component_from_and_to_entity() { |
|
|
|
|
let entity = Entity::new_checked(1337, 42).unwrap(); |
|
|
|
|
let component: Component = entity.into(); |
|
|
|
|
assert!(component.is_entity()); |
|
|
|
|
assert_eq!(entity, component.try_into().unwrap()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn component_from_and_to_relation() { |
|
|
|
|
let relation = Relation::new_checked(20, 21).unwrap(); |
|
|
|
|
let component: Component = relation.into(); |
|
|
|
|
assert!(component.is_relation()); |
|
|
|
|
assert_eq!(relation, component.try_into().unwrap()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|