Skip to content
Snippets Groups Projects
Commit 9d3b05ec authored by Udo Eisenbarth's avatar Udo Eisenbarth :speech_balloon:
Browse files

Add further unit tests.

parent 30959539
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,18 @@ impl OpticNode {
pub fn new(name: String) -> Self {
Self { name }
}
/// Sets the name of this [`OpticNode`].
pub fn set_name(&mut self, name: String) {
self.name = name;
}
/// Returns a reference to the name of this [`OpticNode`].
pub fn name(&self) -> &str {
self.name.as_ref()
}
/// Returns a string representation of the [`OpticNode`] in `graphviz` format.
pub fn to_dot(&self) -> String {
format!(" {}\n", self.name)
}
}
#[cfg(test)]
......@@ -39,4 +41,9 @@ mod test {
let node = OpticNode::new("Test".into());
assert_eq!(node.name(), "Test".to_owned())
}
#[test]
fn to_dot() {
let node = OpticNode::new("Test".into());
assert_eq!(node.to_dot(), " Test\n".to_owned())
}
}
......@@ -53,6 +53,12 @@ mod test {
assert_eq!(scenery.g.node_count(),0);
}
#[test]
fn add_node() {
let mut scenery= OpticScenery::new();
scenery.add_node(OpticNode::new("Test".into()));
assert_eq!(scenery.g.node_count(),1);
}
#[test]
fn to_dot() {
let mut scenery=OpticScenery::new();
scenery.set_description("Test".into());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment