test: add test for entity new and with_attribute constructor functions

This commit is contained in:
2025-09-27 08:43:43 +02:00
parent f32d828b2a
commit 6bc97e36c1
3 changed files with 27 additions and 1 deletions

View 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);
}
}

View 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)
})
);
}
}

View File

@@ -1 +1,2 @@
pub mod entity_new;
pub mod entity_with_attribute;