Skip to content

Commit

Permalink
chore: fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
raklaptudirm committed Dec 29, 2024
1 parent 1a08686 commit d417417
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
18 changes: 8 additions & 10 deletions games/src/games/ataxx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ 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::games::ataxx::*;
/// # use tetka_games::interface::PositionType;
/// # use std::str::FromStr;
///
Expand All @@ -462,14 +462,13 @@ 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::games::ataxx::*;
///
/// let mov = Move::new_single(Square::A1);
///
/// assert_eq!(mov.source(), mov.target());
/// assert_eq!(mov.target(), Square::A1);
/// ```
#[inline(always)]
pub fn new_single(square: Square) -> Move {
Move::new(square, square)
}
Expand All @@ -478,14 +477,13 @@ 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::games::ataxx::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
/// assert_eq!(mov.source(), Square::A1);
/// assert_eq!(mov.target(), Square::A3);
/// ```
#[inline(always)]
#[rustfmt::skip]
pub fn new(source: Square, target: Square) -> Move {
Move(
Expand All @@ -497,7 +495,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::games::ataxx::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -513,7 +511,7 @@ impl Move {

/// Target returns the target Square of the moving piece.
/// ```
/// # use tetka_games::ataxx::*;
/// # use tetka_games::games::ataxx::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -530,7 +528,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::games::ataxx::*;
///
/// let sing = Move::new_single(Square::A1);
/// let jump = Move::new(Square::A1, Square::A3);
Expand Down Expand Up @@ -562,7 +560,7 @@ 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 tetka_games::games::ataxx::*;
/// # use std::str::FromStr;
///
/// let pass = Move::PASS;
Expand Down Expand Up @@ -603,7 +601,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::games::ataxx::*;
///
/// let null = Move::NULL;
/// let pass = Move::PASS;
Expand Down
11 changes: 5 additions & 6 deletions games/src/games/isolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,13 @@ 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::games::isolation::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
/// assert_eq!(mov.pawn(), Square::A1);
/// assert_eq!(mov.tile(), Square::A3);
/// ```
#[inline(always)]
#[rustfmt::skip]
pub fn new(pawn: Square, tile: Square) -> Move {
Move(
Expand All @@ -380,7 +379,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::games::isolation::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand All @@ -394,7 +393,7 @@ impl Move {

/// Target returns the tile Square of the moving piece.
/// ```
/// # use tetka_games::isolation::*;
/// # use tetka_games::games::isolation::*;
///
/// let mov = Move::new(Square::A1, Square::A3);
///
Expand Down Expand Up @@ -423,7 +422,7 @@ 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 tetka_games::games::isolation::*;
/// # use std::str::FromStr;
///
/// let jump = Move::new(Square::A1, Square::A3);
Expand All @@ -446,7 +445,7 @@ 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::games::isolation::*;
/// # use tetka_games::interface::MoveType;
///
/// let null = Move::NULL;
Expand Down

0 comments on commit d417417

Please sign in to comment.