pub mod actor;
pub mod actor_ref;
pub mod logic;
pub mod simple_counter;
pub mod spawn;
pub mod system;
pub mod action;
pub mod context;
pub mod error;
pub mod event;
pub mod guard;
pub mod machine;
pub mod state;
pub mod transition;
#[cfg(feature = "codegen")]
pub mod codegen;
#[cfg(feature = "wasm")]
pub mod wasm;
pub mod integration;
pub use actor::Actor;
pub use actor::ActorError;
pub use actor_ref::ActorRef;
pub use logic::ActorLogic;
pub use spawn::spawn;
pub use system::ActorSystem;
pub use event::{Event, IntoEvent};
pub use action::{Action, ActionType, IntoAction};
pub use context::Context;
pub use error::Result;
pub use error::StateError as Error;
pub use event::EventTrait;
pub use guard::{Guard, IntoGuard};
pub use machine::{Machine, MachineBuilder, MachineSnapshot};
pub use state::{HistoryType, State, StateCollection, StateTrait, StateType};
pub use transition::{Transition, TransitionType};
#[cfg(feature = "wasm")]
pub use crate::wasm::*;
#[cfg(feature = "codegen")]
pub use crate::codegen::*;
pub use crate::integration::{
context_sharing::SharedContext,
event_forwarding::SharedMachineRef, hierarchical::{ChildMachine, DefaultChildMachine}, Error as IntegrationError,
Result as IntegrationResult,
};
pub use serde_json;
#[cfg(test)]
mod tests {
use super::*;
use simple_counter::{CounterActor, CounterEvent};
use tokio::time::{sleep, Duration};
#[tokio::test]
async fn test_counter_actor_with_system() {
println!("Creating ActorSystem...");
let system = ActorSystem::new("test-system");
println!("ActorSystem created: {:?}", system);
println!("Spawning CounterActor using system...");
let counter_ref = system.spawn(CounterActor::new().await, 100); println!("CounterActor spawned with ref: {:?}", counter_ref);
sleep(Duration::from_millis(10)).await;
println!("Sending Increment event...");
let res1 = counter_ref.send(CounterEvent::Increment).await;
assert!(res1.is_ok(), "Failed to send Increment (1)");
println!("Increment event sent.");
sleep(Duration::from_millis(10)).await;
println!("Sending Increment event again...");
let res2 = counter_ref.send(CounterEvent::Increment).await;
assert!(res2.is_ok(), "Failed to send Increment (2)");
println!("Increment event sent.");
sleep(Duration::from_millis(10)).await;
println!("Sending Print event...");
let res3 = counter_ref.send(CounterEvent::Print).await;
assert!(res3.is_ok(), "Failed to send Print");
println!("Print event sent.");
sleep(Duration::from_millis(50)).await;
println!("Original counter test finished. Verify logs for state changes (e.g., count should be 2).");
}
}