From 206361b0858edd1025c1f5255595f211e7403f8b Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Mon, 8 Jun 2026 23:13:59 -0700 Subject: [PATCH] smoke test --- Cargo.lock | 6 ++++-- klondike-cli/Cargo.toml | 4 ++++ klondike-cli/src/test.rs | 13 +++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f30e0af..2009491 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,6 +152,8 @@ dependencies = [ "card_game", "klondike", "rand", + "serde", + "serde_json", ] [[package]] @@ -266,9 +268,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.149" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" dependencies = [ "itoa", "memchr", diff --git a/klondike-cli/Cargo.toml b/klondike-cli/Cargo.toml index a4769cd..5e1399f 100644 --- a/klondike-cli/Cargo.toml +++ b/klondike-cli/Cargo.toml @@ -8,5 +8,9 @@ card_game.workspace = true klondike.workspace = true rand = { version = "0.10.1", default-features = false, features = ["thread_rng"] } +[dev-dependencies] +serde = { version = "1.0.228", default-features = false } +serde_json = "1.0.150" + [lints] workspace = true diff --git a/klondike-cli/src/test.rs b/klondike-cli/src/test.rs index 28c6471..68ca0e0 100644 --- a/klondike-cli/src/test.rs +++ b/klondike-cli/src/test.rs @@ -14,3 +14,16 @@ fn test_is_winnable() { println!("Game is not winnable"); } } + +#[test] +fn test_serde() { + let mut session = Session::new_default(Klondike::with_seed(124)); + let solution_result = session.solve(); + if let Ok(Some(solution)) = solution_result { + for snapshot in solution.clean_solution() { + session.process_instruction(snapshot.instruction().clone()); + } + } + let serialized = serde_json::to_string(&session).unwrap(); + println!("serialized = {serialized}"); +}