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

Add sime unit test for Light

parent 461bd903
No related branches found
No related tags found
No related merge requests found
......@@ -11,13 +11,32 @@ impl Light {
target_port: target_port.into(),
}
}
pub fn src_port(&self) -> &str {
self.src_port.as_ref()
}
pub fn target_port(&self) -> &str {
self.target_port.as_ref()
}
pub fn set_src_port(&mut self, src_port: String) {
self.src_port = src_port;
}
pub fn set_target_port(&mut self, target_port: String) {
self.target_port = target_port;
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn new() {
let light = Light::new("test1", "test2");
assert_eq!(light.src_port, "test1".to_owned());
assert_eq!(light.target_port, "test2".to_owned());
}
#[test]
fn src_port() {
let light = Light::new("test1", "test2");
assert_eq!(light.src_port(), "test1".to_owned());
}
}
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