[board] Write test_position!({starting,empty}) macros
These produce starting and empty positions, respectively, and then print the position.
This commit is contained in:
		
							parent
							
								
									66d03d3514
								
							
						
					
					
						commit
						6bd3787a24
					
				
					 2 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
					@ -28,4 +28,18 @@ macro_rules! test_position {
 | 
				
			||||||
            pos
 | 
					            pos
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    (empty) => {
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            let pos = Position::empty();
 | 
				
			||||||
 | 
					            println!("{pos}");
 | 
				
			||||||
 | 
					            pos
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    (starting) => {
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            let pos = Position::starting();
 | 
				
			||||||
 | 
					            println!("{pos}");
 | 
				
			||||||
 | 
					            pos
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -333,8 +333,7 @@ mod tests {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[test]
 | 
					    #[test]
 | 
				
			||||||
    fn piece_in_starting_position() {
 | 
					    fn piece_in_starting_position() {
 | 
				
			||||||
        let pos = Position::starting();
 | 
					        let pos = test_position!(starting);
 | 
				
			||||||
        println!("{pos}");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert_eq!(
 | 
					        assert_eq!(
 | 
				
			||||||
            pos.piece_on_square(Square::H1),
 | 
					            pos.piece_on_square(Square::H1),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue