standard_card 1.2.0

A Lightweight Library for Efficient Card Representation
Documentation
/// Extract the suit value from the card
///
/// # Arguments
/// - `card` - The card number
///
/// # Returns
/// The suit of the card
///
/// # Example
/// ```
/// use standard_card::card::get_suit;
///
/// let suit = get_suit(541511);
/// assert_eq!(1, suit);
/// ```
pub fn get_suit(card: i32) -> i32 {
    (card >> 6) & 0x3
}

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

    #[test]
    fn ace_of_clubs() {
        // Act
        let actual = get_suit(268471337);

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