From 6bc97e36c144f9067e1ac74ac96131cc59183c4e Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Sat, 27 Sep 2025 08:43:43 +0200 Subject: [PATCH] test: add test for entity new and with_attribute constructor functions --- 01.workspace/heave/src/tst/entity_new.rs | 10 ++++++++++ .../heave/src/tst/entity_with_attribute.rs | 15 +++++++++++++++ 01.workspace/heave/src/tst/mod.rs | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 01.workspace/heave/src/tst/entity_new.rs create mode 100644 01.workspace/heave/src/tst/entity_with_attribute.rs diff --git a/01.workspace/heave/src/tst/entity_new.rs b/01.workspace/heave/src/tst/entity_new.rs new file mode 100644 index 0000000..d28c3b7 --- /dev/null +++ b/01.workspace/heave/src/tst/entity_new.rs @@ -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); + } +} diff --git a/01.workspace/heave/src/tst/entity_with_attribute.rs b/01.workspace/heave/src/tst/entity_with_attribute.rs new file mode 100644 index 0000000..ba07a3f --- /dev/null +++ b/01.workspace/heave/src/tst/entity_with_attribute.rs @@ -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) + }) + ); + } +} diff --git a/01.workspace/heave/src/tst/mod.rs b/01.workspace/heave/src/tst/mod.rs index 8b13789..31af15c 100644 --- a/01.workspace/heave/src/tst/mod.rs +++ b/01.workspace/heave/src/tst/mod.rs @@ -1 +1,2 @@ - +pub mod entity_new; +pub mod entity_with_attribute;