test: add test for entity new and with_attribute constructor functions
This commit is contained in:
10
01.workspace/heave/src/tst/entity_new.rs
Normal file
10
01.workspace/heave/src/tst/entity_new.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::*;
|
||||
#[test]
|
||||
pub fn check_001() {
|
||||
let entity = Entity::new("class");
|
||||
assert_eq!(entity.class, String::from("class"));
|
||||
assert_eq!(entity.attributes.len(), 0);
|
||||
}
|
||||
}
|
||||
15
01.workspace/heave/src/tst/entity_with_attribute.rs
Normal file
15
01.workspace/heave/src/tst/entity_with_attribute.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::*;
|
||||
#[test]
|
||||
pub fn check_001() {
|
||||
let entity = Entity::new("class").with_attribute("a001", 0u64);
|
||||
assert_eq!(
|
||||
entity.attributes.get("a001"),
|
||||
Some(&Attribute {
|
||||
id: "a001".to_string(),
|
||||
value: Value::UnsignedInt(0)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
|
||||
pub mod entity_new;
|
||||
pub mod entity_with_attribute;
|
||||
|
||||
Reference in New Issue
Block a user