Finite state machines in rust; bendns fork to add types.
-rw-r--r--README.md2
-rw-r--r--src/lib.rs2
-rw-r--r--tests/circuit_breaker.rs (renamed from examples/circuit_breaker.rs)3
-rw-r--r--tests/circuit_breaker_dsl.rs (renamed from examples/circuit_breaker_dsl.rs)3
-rw-r--r--tests/simple.rs (renamed from examples/simple.rs)3
5 files changed, 8 insertions, 5 deletions
diff --git a/README.md b/README.md
index fc1e5e9..b80e4d0 100644
--- a/README.md
+++ b/README.md
@@ -114,7 +114,7 @@ wrappers (for now there is only `StateMachine`).
You can see an example of the Circuit Breaker state machine in the
[project repository][repo].
-[repo]: https://github.com/eugene-babichenko/rust-fsm/blob/master/examples/circuit_breaker.rs
+[repo]: https://github.com/eugene-babichenko/rust-fsm/blob/master/tests/circuit_breaker.rs
[docs-badge]: https://docs.rs/rust-fsm/badge.svg
[docs-link]: https://docs.rs/rust-fsm
[crate-badge]: https://img.shields.io/crates/v/rust-fsm.svg
diff --git a/src/lib.rs b/src/lib.rs
index c5e73d0..aaef824 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -110,7 +110,7 @@
//! You can see an example of the Circuit Breaker state machine in the
//! [project repository][repo].
//!
-//! [repo]: https://github.com/eugene-babichenko/rust-fsm/blob/master/examples/circuit_breaker.rs
+//! [repo]: https://github.com/eugene-babichenko/rust-fsm/blob/master/tests/circuit_breaker.rs
#[doc(hidden)]
pub use rust_fsm_dsl::*;
diff --git a/examples/circuit_breaker.rs b/tests/circuit_breaker.rs
index e0bcbbe..a87921b 100644
--- a/examples/circuit_breaker.rs
+++ b/tests/circuit_breaker.rs
@@ -62,7 +62,8 @@ impl StateMachineImpl for CircuitBreakerMachine {
}
}
-fn main() {
+#[test]
+fn circuit_breaker() {
let machine: StateMachine<CircuitBreakerMachine> = StateMachine::new();
// Unsuccessful request
diff --git a/examples/circuit_breaker_dsl.rs b/tests/circuit_breaker_dsl.rs
index 7756f5a..e593625 100644
--- a/examples/circuit_breaker_dsl.rs
+++ b/tests/circuit_breaker_dsl.rs
@@ -16,7 +16,8 @@ state_machine! {
}
}
-fn main() {
+#[test]
+fn circit_breaker_dsl() {
let machine: StateMachine<CircuitBreaker> = StateMachine::new();
// Unsuccessful request
diff --git a/examples/simple.rs b/tests/simple.rs
index 3b4048f..b3fa09c 100644
--- a/examples/simple.rs
+++ b/tests/simple.rs
@@ -10,7 +10,8 @@ state_machine! {
Closed(Break) => Broken,
}
-fn main() {
+#[test]
+fn simple() {
let mut machine: StateMachine<Door> = StateMachine::new();
machine.consume(&DoorInput::Key).unwrap();
println!("{:?}", machine.state());