standard_card 1.2.0

A Lightweight Library for Efficient Card Representation
Documentation
use crate::card::get_rank;

/// Check if the card's current suit matches the given value
///
/// # Arguments
/// * `rank` - The card's rank
/// * `card` - The card's value
///
/// # Example
/// ```
/// use standard_card::card::rank_of;
///
/// let result = rank_of(3, 541511);
/// assert_eq!(true, result);
/// ```
pub fn rank_of(rank: i32, card: i32) -> bool {
    rank == get_rank(card)
}

#[cfg(test)]
mod rank_of {
    use crate::card::rank_of;

    #[test]
    fn match_ace_of_clubs() {
        // Act
        let actual = rank_of(12, 268471337);

        // Assert
        assert_eq!(actual, true);
    }

    #[test]
    fn not_match_ace_of_clubs() {
        // Act
        let actual = rank_of(2, 268471337);

        // Assert
        assert_eq!(actual, false);
    }
}