1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#![deny(missing_docs)]
#![doc(html_root_url = "https://docs.rs/transition/0.1.1")]
#[cfg(test)]
mod testutils;
mod color;
mod error;
mod msg;
mod notifier;
mod task;
mod transition;
pub use crate::color::Led;
pub use crate::transition::Transition;
pub use error::TransitionErr;
pub use notifier::Notifier;
#[cfg(test)]
mod test {
use crate::testutils::utils::init_logging;
use crate::Transition;
use crate::TransitionErr;
use doc_comment::doctest;
use log::debug;
use std::time::Duration;
doctest!("../README.md");
#[test]
fn test_clone_of_transition() -> Result<(), TransitionErr> {
init_logging();
let transition = Transition::default();
let other_transition = transition.clone();
let notifier = transition.start()?;
std::thread::sleep(Duration::from_millis(1000));
notifier.notify_failure()?;
let notifier = other_transition.start()?;
std::thread::sleep(Duration::from_millis(1000));
notifier.notify_success()?;
Ok(())
}
#[test]
fn test_debug_of_transition() {
init_logging();
let transition = Transition::default();
debug!("testing Debug of transition: {:#?}", transition);
}
#[test]
fn test_debug_of_notifier() -> Result<(), TransitionErr> {
init_logging();
let notifier = Transition::default().start()?;
debug!("testing Debug of notifier: {:#?}", notifier);
Ok(())
}
}