diff --git a/Cargo.lock b/Cargo.lock index bf1d8239..bf57ed13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -432,9 +432,9 @@ dependencies = [ [[package]] name = "cubing" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73276c112792e122837172563b03ed33598811970a6716bcbddd1dca9af413ec" +checksum = "e824afa5a0412eb73c945d50a4d9529f15e2862a72611799f89bc7e355011c16" dependencies = [ "derive_more", "nom 7.1.3", diff --git a/src/cpp/Cargo.toml b/src/cpp/Cargo.toml index 83e4d315..c1be3f76 100644 --- a/src/cpp/Cargo.toml +++ b/src/cpp/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] clap = { version = "4.3.24", features = ["derive"] } clap_complete = "4.3.2" -cubing = "0.7.1" +cubing = "0.7.2" cxx = "1.0.106" lazy_static = "1.4.0" num_cpus = "1.16.0" diff --git a/src/rs/Cargo.toml b/src/rs/Cargo.toml index 7c735928..9bbc3b69 100644 --- a/src/rs/Cargo.toml +++ b/src/rs/Cargo.toml @@ -10,7 +10,7 @@ default = [] cityhash = "0.1.1" clap = { version = "4.3.24", features = ["derive"] } clap_complete = "4.3.2" -cubing = "0.7.1" +cubing = "0.7.2" derive_more = "0.99.17" indicatif = "0.17.6" serde = { version = "1.0.186", features = ["derive", "rc"] } diff --git a/src/rs/packed/orientation_packer.rs b/src/rs/packed/orientation_packer.rs index f2e75363..dd72a17b 100644 --- a/src/rs/packed/orientation_packer.rs +++ b/src/rs/packed/orientation_packer.rs @@ -132,57 +132,34 @@ impl OrientationPacker { #[cfg(test)] mod tests { use cubing::kpuzzle::{ - KPattern, KPatternData, KPatternOrbitData, KPuzzle, KPuzzleDefinition, - KPuzzleOrbitDefinition, KPuzzleOrbitName, KTransformationData, KTransformationOrbitData, + KPattern, KPatternData, KPatternOrbitData, KPuzzle, KPuzzleDefinition, KPuzzleOrbitName, }; - use std::collections::HashMap; - use std::sync::Arc; use crate::PackedKPuzzle; // TODO: Return a `Result`. #[test] fn orientation_mod() { - let def = KPuzzleDefinition { - name: "custom".to_owned(), - orbits: vec![KPuzzleOrbitDefinition { - orbit_name: "PIECES".into(), - num_pieces: 2, - num_orientations: 12, - }], - default_pattern: KPatternData::from([( - KPuzzleOrbitName("PIECES".into()), - KPatternOrbitData { - pieces: vec![0, 1], - orientation: vec![0, 0], - orientation_mod: Some(vec![3, 4]), - }, - )]) - .into(), - moves: HashMap::from([ - ( - "SPIN".try_into().unwrap(), - Arc::new(KTransformationData::from([( - KPuzzleOrbitName("PIECES".to_owned()), - KTransformationOrbitData { - permutation: vec![0, 1], // TODO: is this actually L'? - orientation_delta: vec![2, 5], - }, - )])), - ), - ( - "SWAP".try_into().unwrap(), - Arc::new(KTransformationData::from([( - KPuzzleOrbitName("PIECES".to_owned()), - KTransformationOrbitData { - permutation: vec![1, 0], // TODO: is this actually R'? - orientation_delta: vec![0, 0], - }, - )])), - ), - ]), - derived_moves: None, - }; + let def: KPuzzleDefinition = serde_json::from_str( + r#" +{ + "name": "custom", + "orbits": [{ "orbitName": "PIECES", "numPieces": 2, "numOrientations": 12 }], + "defaultPattern": { + "PIECES": { + "pieces": [0, 1], + "orientation": [0, 0], + "orientationMod": [3, 4] + } + }, + "moves": { + "SWAP": { "PIECES": { "permutation": [1, 0], "orientationDelta": [0, 0] } }, + "SPIN": { "PIECES": { "permutation": [0, 1], "orientationDelta": [2, 5] } } + }, + "derivedMoves": null +}"#, + ) + .unwrap(); let kpuzzle = KPuzzle::try_new(def).unwrap(); let packed_kpuzzle = PackedKPuzzle::try_from(kpuzzle.clone()).unwrap();