Skip to content

Commit

Permalink
chore: fix some doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
raklaptudirm committed Dec 26, 2024
1 parent cdb4c36 commit 268fd04
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
22 changes: 11 additions & 11 deletions games/src/ataxx/move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ impl Move {
pub const NULL: Move = Move(1 << 15);
/// PASS Move represents a no move, where only the side to move changes.
/// ```
/// use tetka_games::ataxx::*;
/// use tetka_games::interface::PositionType;
/// use std::str::FromStr;
/// # use tetka_games::ataxx::*;
/// # use tetka_games::interface::PositionType;
/// # use std::str::FromStr;
///
/// let old_pos = Position::from_str("x5o/7/7/7/7/7/o5x x 0 1").unwrap();
/// let new_pos = old_pos.after_move::<true>(Move::PASS);
Expand All @@ -75,7 +75,7 @@ impl Move {
/// target Square. For a singular Move, [`Move::source`] and [`Move::target`]
/// are equal since the source Square is irrelevant to the Move.
/// ```
/// use tetka_games::ataxx::*;
/// # use tetka_games::ataxx::*;
///
/// let mov = Move::new_single(Square::A1);
///
Expand All @@ -91,7 +91,7 @@ impl Move {
/// target Square. These Squares can be recovered with the [`Move::source`] and
/// [`Move::target`] methods respectively.
/// ```
/// use tetka_games::ataxx::*;
/// # use tetka_games::ataxx::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -110,7 +110,7 @@ impl Move {
/// Source returns the source Square of the moving piece. This is equal to the
/// target Square if the given Move is of singular type.
/// ```
/// use tetka_games::ataxx::*;
/// # use tetka_games::ataxx::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -126,7 +126,7 @@ impl Move {

/// Target returns the target Square of the moving piece.
/// ```
/// use tetka_games::ataxx::*;
/// # use tetka_games::ataxx::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -143,7 +143,7 @@ impl Move {
/// is_single checks if the given Move is singular in nature. The result of this
/// function for [`Move::NULL`] and [`Move::PASS`] is undefined.
/// ```
/// use tetka_games::ataxx::*;
/// # use tetka_games::ataxx::*;
///
/// let sing = Move::new_single(Square::A1);
/// let jump = Move::new(Square::A1, Square::A3);
Expand Down Expand Up @@ -175,8 +175,8 @@ impl FromStr for Move {
/// [`Square::FromStr`](Square::from_str). This function can be treated as the
/// inverse of the [`fmt::Display`] trait for [Move].
/// ```
/// use tetka_games::ataxx::*;
/// use std::str::FromStr;
/// # use tetka_games::ataxx::*;
/// # use std::str::FromStr;
///
/// let pass = Move::PASS;
/// let sing = Move::new_single(Square::A1);
Expand Down Expand Up @@ -216,7 +216,7 @@ impl fmt::Display for Move {
/// refer to `Square::Display`. [`Move::NULL`] is formatted as `null`, while
/// [`Move::PASS`] is formatted as `0000`.
/// ```
/// use tetka_games::ataxx::*;
/// # use tetka_games::ataxx::*;
///
/// let null = Move::NULL;
/// let pass = Move::PASS;
Expand Down
13 changes: 7 additions & 6 deletions games/src/isolation/move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Move {
/// tile Square. These Squares can be recovered with the [`Move::pawn`] and
/// [`Move::tile`] methods respectively.
/// ```
/// use tetka_games::isolation::*;
/// # use tetka_games::isolation::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -77,7 +77,7 @@ impl Move {
/// Source returns the pawn Square of the moving piece. This is equal to the
/// tile Square if the given Move is of singular type.
/// ```
/// use tetka_games::isolation::*;
/// # use tetka_games::isolation::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -91,7 +91,7 @@ impl Move {

/// Target returns the tile Square of the moving piece.
/// ```
/// use tetka_games::isolation::*;
/// # use tetka_games::isolation::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand Down Expand Up @@ -120,8 +120,8 @@ impl FromStr for Move {
/// parsed, take a look at [`Square::FromStr`](Square::from_str). This function
/// can be treated as the inverse of the [`fmt::Display`] trait for [Move].
/// ```
/// use tetka_games::isolation::*;
/// use std::str::FromStr;
/// # use tetka_games::isolation::*;
/// # use std::str::FromStr;
///
/// let jump = Move::new(Square::A1, Square::A3);
/// assert_eq!(Move::from_str(&jump.to_string()).unwrap(), jump);
Expand All @@ -143,7 +143,8 @@ impl fmt::Display for Move {
/// for displaying moves is `<pawn><tile>`. For the formatting of `<pawn>` and
/// `<tile>`, refer to `Square::Display`. [`Move::NULL`] is formatted as `null`.
/// ```
/// use tetka_games::isolation::*;
/// # use tetka_games::isolation::*;
/// # use tetka_games::interface::MoveType;
///
/// let null = Move::NULL;
/// let jump = Move::new(Square::A1, Square::A3);
Expand Down

0 comments on commit 268fd04

Please sign in to comment.