fantasy_realms_unofficial_api 0.1.0

An unofficial API for the Fantasy Realms card game.
Documentation
use crate::{card_collection::CardCollection, deck::{BELL_TOWER, BOOK_OF_CHANGES, DRAGON, GEM_OF_ORDER, MOUNTAIN, WARLOCK_LORD, WARLORD, WORLD_TREE}, hand::Hand};

use super::deck::*;

#[test]
fn hand1() {
    let discard_pile = CardCollection::new();
    let hand: Hand = Hand::new([
        WORLD_TREE,
        GEM_OF_ORDER,
        WARLORD,
        BELL_TOWER,
        DRAGON,
        BOOK_OF_CHANGES,
        WARLOCK_LORD,
    ]);
    let score: i16 = 
        2 +
        35 +
        34 +
        23 +
        30 +
        3 +
        15;
    assert_eq!(hand.score(&discard_pile), score);
}

#[test]
fn hand2() {
    let discard_pile = CardCollection::new();
    let hand: Hand = Hand::new([
        WILDFIRE,
        LIGHT_CAVALRY,
        WARSHIP,
        MIRAGE,
        SMOKE,
        KING,
        EMPRESS,
    ]);
    let score: i16 = 
        40 +
        0 +
        23 +
        27 + 
        0 +
        0 +
        0;
    assert_eq!(hand.score(&discard_pile), score);
}

#[test]
fn hand3() {
    let discard_pile = CardCollection::new();
    let hand: Hand = Hand::new([
        WARHORSE,
        FOUNTAIN_OF_LIFE,
        WATER_ELEMENTAL,
        HYDRA,
        RAINSTORM,
        AIR_ELEMENTAL,
        BASILISK,
    ]);
    let score: i16 = 
        0 +
        9 +
        19 +
        0 + 
        28 +
        19 +
        35;
    assert_eq!(hand.score(&discard_pile), score);
}

#[test]
fn hand4() {
    let discard_pile = CardCollection::new();
    let hand: Hand = Hand::new([
        SWAMP,
        SWORD_OF_KETH,
        RANGERS,
        FORGE,
        FIRE_ELEMENTAL,
        PRINCESS,
        PROTECTION_RUNE,
    ]);
    let score: i16 = 
        18 +
        17 +
        5 +
        27 + 
        19 +
        10 +
        1;
    assert_eq!(hand.score(&discard_pile), score);
}

#[test]
fn hand5() {
    let discard_pile = CardCollection::new();
    let hand: Hand = Hand::new([
        GREAT_FLOOD,
        WHIRLWIND,
        MOUNTAIN,
        DOPPELGANGER,
        EARTH_ELEMENTAL,
        DWARVISH_INFANTRY,
        MAGIC_WAND,
    ]);
    let score: i16 = 
        32 +
        13 +
        9 +
        32 + 
        19 +
        1 +
        15;
    assert_eq!(hand.score(&discard_pile), score);
}

#[test]
fn hand6() {
    let discard_pile = CardCollection::new();
    let hand: Hand = Hand::new([
        ENCHANTRESS,
        BEASTMASTER,
        COLLECTOR,
        ELVEN_ARCHERS,
        SHAPESHIFTER,
        ISLAND,
        BLIZZARD,
    ]);
    let score: i16 = 
        10 +
        9 +
        47 +
        10 + 
        0 +
        0 +
        25;
    assert_eq!(hand.score(&discard_pile), score);
}

#[test]
fn hand7() {
    let mut discard_pile = CardCollection::new();
    discard_pile += DWARVISH_INFANTRY;
    discard_pile += WORLD_TREE;
    discard_pile += GEM_OF_ORDER;
    discard_pile += CAVERN;
    discard_pile += WARLORD;
    discard_pile += BELL_TOWER;
    discard_pile += AIR_ELEMENTAL;
    discard_pile += DRAGON;
    discard_pile += ENCHANTRESS;
    discard_pile += BOOK_OF_CHANGES;
    let hand: Hand = Hand::new([
        KING,
        WARLOCK_LORD,
        KNIGHTS,
        NECROMANCER,
        UNICORN,
        ELVEN_LONGBOW,
        WAR_DIRIGIBLE,
    ]);
    let score: i16 = 
        13 -
        5 +
        20 +
        3 + 
        9 +
        33 +
        35 +
        24;
    assert_eq!(hand.score(&discard_pile), score);
}