#include "Bank.h"
#include <string>
using namespace std;
#include <cassert>

void main()
{
    Bank bank("CS Minibank");

    string aliceName("Alice"), aliceID("C123456789");
    string bobName("Bob"), bobID("D987654321");
    string carolName("Carol"), carolID("A123454321");
    int aliceAccID=0, bobAccID, carolAccID;

    assert(!bank.deposit(aliceAccID, 5000)); // 還沒有開戶的情況下
    assert(!bank.withdraw(aliceAccID, 5000));// aliceAccID = 0, 
    assert(bank.inquire(aliceAccID) < 0);    // 這些動作都不會成功

    assert(aliceAccID = bank.createAccount(aliceName, aliceID));
    assert(bank.inquire(aliceAccID) == 0);
    assert(bank.deposit(aliceAccID, 10000));
    assert(bank.inquire(aliceAccID) == 10000);

    assert(bobAccID = bank.createAccount(bobName, bobID));
    assert(bank.deposit(bobAccID, 23400));
    assert(bank.inquire(bobAccID) == 23400);

    assert(carolAccID = bank.createAccount(carolName, carolID));
    assert(bank.deposit(carolAccID, 53500));
    assert(bank.inquire(carolAccID) == 53500);

    assert(bank.withdraw(bobAccID, 3400));
    assert(bank.inquire(bobAccID) == 20000);

    assert(bank.transfer(carolAccID, aliceAccID, 13500));
    assert(bank.inquire(carolAccID) == 40000);
    assert(bank.inquire(aliceAccID) == 23500);

    assert(!bank.transfer(carolAccID, bobAccID, 50000)); // 失敗
    assert(!bank.withdraw(aliceAccID, 33500)); // 失敗

    assert(bank.withdraw(aliceAccID, 8500));
    assert(bank.inquire(aliceAccID) == 15000);

    assert(bank.dailyAudit());

    system("pause");
}