|
@@ -220,7 +220,21 @@ mod tests {
|
|
assert!(load.is_ok());
|
|
assert!(load.is_ok());
|
|
|
|
|
|
// Ok, puzzle is loaded!
|
|
// Ok, puzzle is loaded!
|
|
- board.display();
|
|
|
|
|
|
+ let strings = board.to_strings();
|
|
|
|
+ assert_eq!(
|
|
|
|
+ strings,
|
|
|
|
+ vec![
|
|
|
|
+ " 4 8 ",
|
|
|
|
+" 6 1 2 ",
|
|
|
|
+"3 9 5 6",
|
|
|
|
+" 72 16 ",
|
|
|
|
+" 3 9 ",
|
|
|
|
+" 18 35 ",
|
|
|
|
+"9 3 6 2",
|
|
|
|
+" 4 5 8 ",
|
|
|
|
+" 3 7 ",
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
|
|
let mut testfile = test_files_path();
|
|
let mut testfile = test_files_path();
|
|
testfile.push("16-puzzle");
|
|
testfile.push("16-puzzle");
|
|
@@ -237,7 +251,29 @@ mod tests {
|
|
assert!(load.is_ok());
|
|
assert!(load.is_ok());
|
|
|
|
|
|
// Ok, puzzle is loaded!
|
|
// Ok, puzzle is loaded!
|
|
- board.display();
|
|
|
|
|
|
+ let strings: Vec<String> = board.to_strings();
|
|
|
|
+ assert_eq!(
|
|
|
|
+ strings,
|
|
|
|
+ vec![
|
|
|
|
+ " D O C IN",
|
|
|
|
+ "A ENC IL ",
|
|
|
|
+ "NG AP J MHC ",
|
|
|
|
+ " P H D A FOL",
|
|
|
|
+ "IOHKFB A L P",
|
|
|
|
+ " BN M E L ID ",
|
|
|
|
+ "LE O AN K BC ",
|
|
|
|
+ " C H JO EF",
|
|
|
|
+ "EN GP A F ",
|
|
|
|
+ " OG J IM L NC",
|
|
|
|
+ " MK B C N PG ",
|
|
|
|
+ "C L F PEMIKO",
|
|
|
|
+ "OPC N H F J ",
|
|
|
|
+ " EHJ I MA CK",
|
|
|
|
+ " FM IPA D",
|
|
|
|
+ "FM L H P "
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
+ // board.display();
|
|
|
|
|
|
let mut testfile = test_files_path();
|
|
let mut testfile = test_files_path();
|
|
testfile.push("25-puzzle");
|
|
testfile.push("25-puzzle");
|
|
@@ -254,7 +290,39 @@ mod tests {
|
|
assert!(load.is_ok());
|
|
assert!(load.is_ok());
|
|
|
|
|
|
// Ok, puzzle is loaded!
|
|
// Ok, puzzle is loaded!
|
|
- board.display();
|
|
|
|
|
|
+ // board.display();
|
|
|
|
+ let strings: Vec<String> = board.to_strings();
|
|
|
|
+ assert_eq!(
|
|
|
|
+ strings,
|
|
|
|
+ vec![
|
|
|
|
+ " T DPF Y H R WSX L ",
|
|
|
|
+ "L QF J X C G UB D",
|
|
|
|
+ " CK S LNRP G UTQO H MA ",
|
|
|
|
+ "JG H S XELDUPM F B RT",
|
|
|
|
+ "Y N RQ UCDOK AISJL HP G E",
|
|
|
|
+ "F OA N UK VQI HY B DT C",
|
|
|
|
+ " S A C VUE GJQ N I R ",
|
|
|
|
+ " CPD JGMIA OELSU VBK ",
|
|
|
|
+ " G LE D BHT XMW K PI Y ",
|
|
|
|
+ " EXIBOWFLY VAMTJUGQS ",
|
|
|
|
+ "G HV TMI EWF BR O",
|
|
|
|
+ " A JFUK W P D M GLXE N ",
|
|
|
|
+ "R LN G O QI F",
|
|
|
|
+ " S TCYP B H O X JNAK M ",
|
|
|
|
+ "M XK ALJ UHQ GP Y",
|
|
|
|
+ " VTRYBSEFM KWOICJNLG ",
|
|
|
|
+ " U XD J WCN RTA E QY P ",
|
|
|
|
+ " HQN COVTJ EBGDL WSF ",
|
|
|
|
+ " F X Y LWB SVJ R T O ",
|
|
|
|
+ "E CJ R AN GOF XH V MD B",
|
|
|
|
+ "S V OI ANHDC TGLQJ YF X P",
|
|
|
|
+ "CX L K RFUYBWO V A DQ",
|
|
|
|
+ " FR H DQOC K INBW T UY ",
|
|
|
|
+ "T JL G I P F OC W",
|
|
|
|
+ " B KMV Q J H GRI E "
|
|
|
|
+
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|