standard_card 1.4.0

A Lightweight Library for Efficient Card Representation
Documentation
/// Check if the card's current suit is red
///
/// # Arguments
/// `card` - The card number
///
/// # Example
/// ```
/// use standard_card::card::is_red;
///
/// let result = is_red(268455017);
/// assert_eq!(true, result);
/// ```
pub fn is_red(card: i32) -> bool {
    card & 0x6000 != 0
}

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

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

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

    #[test]
    fn ace_of_diamonds() {
        // Act
        let actual = is_red(268455017);

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