////
//
// This program performs some basic tests on the functions defined in
// card-play.cpp, q.v.
//
// NOTE: these tests are not exhaustive, they just do some basics.  More
// thorough testing is done in other testing programs, such as
// card-read-tests.cpp, q.v.
//
////

#include "card-play.h"
#include <iostream.h>
#include <fstream.h>


const int MAX_HAND_SIZE = 20;   // Maximum number of cards in any hand

int main() {

    //
    // Declare some variable to work with.
    //
    char deck[DECK_SIZE][CARD_STR_LEN];              // Basic deck
    char players_hand[MAX_HAND_SIZE][CARD_STR_LEN];  // Sample hand of cards
    char dealers_hand[MAX_HAND_SIZE][CARD_STR_LEN];  //    "    "   "    "
    ifstream deck_file;                              // File containing cards
    char card[CARD_STR_LEN];                         // Sample card as string
    int card_face_value;                             // Sample card as int
    char card_suit;                                  //   and char

    //
    // Read a card from the terminal as a string.
    //
    ReadCardAsString(card);
    cout << "Card read as string: " << card << endl;

    //
    // Read a card from the terminal as an int and char.
    //
    ReadCardAsIntAndChar(card_face_value, card_suit);
    cout << "Card read as face value and suit: "
         << card_face_value << ", " << card_suit << endl;


    //
    // Open the sample card deck file, read it in, and dump it back out.
    //
    deck_file.open("fulldeck");
    ReadDeckFromFile(deck_file, deck);
    DumpDeck(deck);

    //
    // Perform some additional tests on the card handling functions.
    //
    cout << "Input a card value: ";
    cin >> players_hand[0];

    cout << "Value just put in players_hand[0] = " << players_hand[0] << endl;

    cout << "Size of dealer's and player's hands (should be 20*4): "
         << sizeof(dealers_hand) << ", " << sizeof(players_hand) << endl;

    cout << "Size of a hand elem: " << sizeof(players_hand[0]) << endl;

    return 0;
}