亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testclasses.cpp

?? SSD5 exercise1 需要的自己下載
?? CPP
字號:
/*
  This application test your implentations of Date, Advertisement and Client

  NOTE: Place comments in function main to test each individual class
*/

#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>

#include "Date.h"
#include "Advertisement.h"
#include "Client.h"

bool testDate(void);
bool testAdvertisement(void);
bool testClient(void);

int main(int argc, char* argv[]) {

    /* */
    cerr << "Class Date: ";
    if (! testDate()) {
        return EXIT_FAILURE;
    }
    cout << "Tests passed\n\n";

    /* Document the code below for just test class Date */
    cerr << "Class Advertisement: ";
    if (! testAdvertisement()) {
        return EXIT_FAILURE;
    }
    cout << "Tests passed\n\n";

    /* Document the code below for just test classes Advertisement and Date */
    cerr << "Class Client: ";
    if (! testClient()) {
        return EXIT_FAILURE;
    }
    cout << "Tests passed\n\n";
    /* */

    cout << "All tests passed\n";

    return EXIT_SUCCESS;
}

bool testDateConstructors(void);
bool testDateLessThan(void);
bool testDateEqual(void);
bool testDateInsertion(void);
bool testDateExtraction(void);

bool testAdvertisementConstructors(void);
bool testAdvertisementEqual(void);
bool testAdvertisementInsertion(void);

bool testClientConstructors(void);
bool testClientVerifyPasswd(void);
bool testClientInsertion(void);

bool testDate(void) {

    if (! testDateConstructors()) {
        cerr << "Error, constructor and\\or accessors failed check\n";
        return false;
    }

    if (! testDateLessThan()) {
        cerr << "Error, operator < failed check\n";
        return false;
    }

    if (! testDateEqual()) {
        cerr << "Error, operator == failed check\n";
        return false;
    }

    if (! testDateInsertion()) {
        cerr << "Error, operator >> failed check\n";
        return false;
    }

    if (! testDateExtraction()) {
        cerr << "Error, operator << failed check\n";
        return false;
    }

    return true;
}

bool testDateConstructors(void) {

    Date d(8, 17, 1976, 1, 2, 3);
    Date e;

    return
        d.getMonth() == 8
        && d.getDay() == 17
        && d.getYear() == 1976
        && d.getHour() == 1
        && d.getMinute() == 2
        && d.getSecond() == 3
        && e.getMonth() == 0
        && e.getDay() == 0
        && e.getYear() == 0
        && e.getHour() == 0
        && e.getMinute() == 0
        && e.getSecond() == 0;
}


bool testDateLessThan(void) {

    Date d1(1, 1, 2008, 1, 1, 1);
    Date d2(2, 1, 2008, 1, 1, 1);
    Date d3(1, 2, 2008, 1, 1, 1);
    Date d4(1, 1, 2009, 1, 1, 1);
    Date d5(1, 1, 2008, 2, 1, 1);
    Date d6(1, 1, 2008, 1, 2, 1);
    Date d7(1, 1, 2008, 1, 1, 2);

    return
        d1 < d2
        && d1 < d3
        && d1 < d4
        && d1 < d5
        && d1 < d6
        && d1 < d7
        && ! (d2 < d1)
        && ! (d3 < d1)
        && ! (d4 < d1)
        && ! (d5 < d1)
        && ! (d6 < d1)
        && ! (d7 < d1)
        && (d3 < d2)
        && (d2 < d4)
        && ! (d4 < d2)
        && (d7 < d6)
        && (d6 < d5)
        && ! (d5 < d7);
}

bool testDateEqual(void) {

    Date d(1, 1, 2008, 1, 1, 1);
    Date same(1, 1, 2008, 1, 1, 1);
    Date d2(d);
    Date d3(d);
    Date d4(d);
    Date d5(d);
    Date d6(d);
    Date d7(d);

    int differentMonth = 2;
    int differentDay = 3;
    int differentYear = 2009;
    int differentHours = 5;
    int differentMinutes = 6;
    int differentSeconds = 7;

    d2.setMonth(differentMonth);
    d3.setDay(differentDay);
    d4.setYear(differentYear);
    d5.setHour(differentHours);
    d6.setMinute(differentMinutes);
    d7.setSecond(differentSeconds);

    return
        d == same
        && same == d
        && ! (d2 == d)
        && ! (d3 == d)
        && ! (d4 == d)
        && ! (d5 == d)
        && ! (d6 == d)
        && ! (d7 == d);
}

bool testDateInsertion(void) {

    stringstream strm;
    strm << "8/17/1976 1:2:3\n";

    Date d;
    strm >> d;

    return
        d.getMonth() == 8
        && d.getDay() == 17
        && d.getYear() == 1976
        && d.getHour() == 1
        && d.getMinute() == 2
        && d.getSecond() == 3;
}

bool testDateExtraction(void) {

    stringstream strm;
    Date d(8, 17, 1976, 1, 2, 3);
    strm << d;

    string s;
    getline(strm, s);

    return s.compare("8/17/1976 1:2:3") == 0;
}

bool testAdvertisement(void) {

    if (! testAdvertisementConstructors()) {
        cerr << "Error, constructor and\\or accessors failed check\n";
        return false;
    }

    if (! testAdvertisementEqual()) {
        cerr << "Error, operator == failed check\n";
        return false;
    }

    if (! testAdvertisementInsertion()) {
        cerr << "Error, operator >> failed check\n";
        return false;
    }

    return true;
}

bool testAdvertisementConstructors(void) {

    string title = "aTitle";
    string seller_email = "email@email.com";
    string body = "aBody";

    Date start(1, 15, 2007, 1, 2, 3);
    Date close(6, 30, 2008, 4, 5, 6);
    Date defaultDate;

    int quantity = 5;

    Advertisement a0;
    Advertisement a1(title, seller_email, body, start, close, quantity);
    Advertisement a2(a1);

    return
        a0.getNumber() == -1
        && a0.getTitle() == ""
        && a0.getEmail() == ""
        && a0.getBody() == ""
        && a0.getStart() == defaultDate
        && a0.getClose() == defaultDate
        && a0.getQuantity() == 0
        && a1.getNumber() == -1
        && a1.getTitle() == title
        && a1.getEmail() == seller_email
        && a1.getBody() == body
        && a1.getStart() == start
        && a1.getClose() == close
        && a1.getQuantity() == quantity
        && a2.getNumber() == -1
        && a2.getTitle() == title
        && a2.getEmail() == seller_email
        && a2.getBody() == body
        && a2.getStart() == start
        && a2.getClose() == close
        && a2.getQuantity() == quantity;
}

bool testAdvertisementEqual(void) {

    string title = "aTitle";
    string email = "email@email.com";
    string body = "aBody";
    string otherString = "other";
    string otherEmail = "other@other.com";

    Date start(1, 1, 2007, 1, 1, 1);
    Date otherStart(2, 1, 2007, 1, 1, 1);
    Date close(2, 2, 2008, 2, 2, 2);
    Date otherClose(3, 2, 2008, 2, 2, 2);

    Advertisement a(title, email, body, start, close, 2);
    Advertisement same(title, email, body, start, close, 2);

    Advertisement different(a);
    different.setNumber(11);

    Advertisement a1(a);
    Advertisement a2(a);
    Advertisement a3(a);
    Advertisement a4(a);
    Advertisement a5(a);
    Advertisement a6(a);

    a1.setTitle(otherString);
    a2.setEmail(otherEmail);
    a3.setBody(otherString);
    a4.setStart(otherStart);
    a5.setClose(otherClose);
    a6.setQuantity(22);

    return
        a == same
        && same == a
        && ! (different == a)
        && (a1 == a)
        && (a2 == a)
        && (a3 == a)
        && (a4 == a)
        && (a5 == a)
        && (a6 == a);
}

bool testAdvertisementInsertion(void) {

    stringstream strm;
    Advertisement a;

    strm << "title\nemail@email.com\n3\n1/2/2008 3:4:5\n 6/7/2009 8:9:0\nbody\n";
    strm >> a;

    Date start(1, 2, 2008, 3, 4, 5);
    Date close(6, 7, 2009, 8, 9, 0);

    return
        a.getTitle() == "title"
        && a.getEmail() == "email@email.com"
        && a.getQuantity() == 3
        && a.getStart() == start
        && a.getClose() == close
        && a.getBody() == "body";
}

bool testClient(void) {

    if (! testClientConstructors()) {
        cerr << "Error, constructor and\\or accessors failed check\n";
        return false;
    }

    if (! testClientVerifyPasswd()) {
        cerr << "Error, function verifyPassword failed check\n";
        return false;
    }

    if (! testClientInsertion()) {
        cerr << "Error, operator >> failed check\n";
        return false;
    }

    return true;
}

bool testClientConstructors(void) {

    string fname ="aFname";
    string lname = "aLname";
    string email = "email@email.com";
    string passwd = "aPasswad";

    Client c0;
    Client c1(fname, lname, email, passwd);
    Client c2(c1);

    return
        c0.getFname() == ""
        && c0.getLname() == ""
        && c0.getEmail() == ""
        && c0.getPasswd() == ""
        && c1.getFname() == fname
        && c1.getLname() == lname
        && c1.getEmail() == email
        && c1.getPasswd() == passwd
        && c2.getFname() == fname
        && c2.getLname() == lname
        && c2.getEmail() == email
        && c2.getPasswd() == passwd;
}

bool testClientVerifyPasswd(void) {

    Client c0;
    c0.setPasswd("correctPassword");

    return
        c0.verifyPasswd("correctPassword")
        && ! (c0.verifyPasswd("incorrectPassword"));
}

bool testClientInsertion(void) {

    stringstream strm;
    Client c;

    strm << "fname\nlname\nemail@email.com\npassword\n";
    strm >> c;

    return
        c.getFname() == "fname"
        && c.getLname() == "lname"
        && c.getEmail() == "email@email.com"
        && c.getPasswd() == "password";
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产日韩在线一区模特 | 日韩av一二三| 亚洲人快播电影网| 欧美激情一区二区三区不卡| 国产欧美日韩在线| 中文字幕成人av| 中文字幕av一区二区三区高| 国产三级精品三级| 国产精品网友自拍| 中文字幕一区二区5566日韩| 日韩美女精品在线| 伊人一区二区三区| 香蕉成人啪国产精品视频综合网| 亚洲一卡二卡三卡四卡无卡久久| 亚洲综合色婷婷| 丝袜脚交一区二区| 美女网站在线免费欧美精品| 蜜桃视频在线一区| 国产一区久久久| 粉嫩一区二区三区在线看| 成人黄色小视频在线观看| 99热精品一区二区| 欧美色区777第一页| 欧美一区二区三区视频| 精品国产乱码久久久久久闺蜜 | 国产精品国产三级国产aⅴ中文| 亚洲国产成人午夜在线一区| 亚洲欧洲精品一区二区精品久久久| 亚洲另类春色校园小说| 亚洲成人黄色小说| 精品制服美女久久| 成人毛片老司机大片| 色婷婷av久久久久久久| 欧美精品久久天天躁| 欧美精品一区二区蜜臀亚洲| 国产精品色噜噜| 亚洲自拍偷拍九九九| 蜜桃视频在线观看一区| 国产.欧美.日韩| 欧美三级日韩三级| 久久这里只有精品6| 亚洲日本欧美天堂| 久久99精品久久久久| www.色综合.com| 91精品国产综合久久精品| 国产日产精品一区| 午夜欧美在线一二页| 成人丝袜18视频在线观看| 欧美日韩在线播| 国产亚洲成aⅴ人片在线观看| 亚洲精选视频在线| 精品一区二区三区不卡| 一本久久精品一区二区| 精品国产伦一区二区三区免费 | 国产成人亚洲精品青草天美| 在线观看亚洲专区| 久久中文字幕电影| 天堂va蜜桃一区二区三区漫画版| 国产成人免费视频网站| 欧美日本免费一区二区三区| 亚洲国产精品国自产拍av| 日韩精品一二三区| 成人免费看片app下载| 91精选在线观看| 国产精品情趣视频| 加勒比av一区二区| 欧美三级电影一区| 成人性生交大片免费看中文| 欧美日本在线一区| 亚洲欧美一区二区三区孕妇| 国产精品亚洲视频| 91精品欧美久久久久久动漫| 亚洲天堂久久久久久久| 国产综合久久久久久鬼色| 欧美日韩国产免费| 亚洲免费观看高清完整版在线观看熊 | 国产精品久久国产精麻豆99网站| 免费高清在线一区| 欧美日韩另类一区| 1区2区3区国产精品| 国产乱子轮精品视频| 欧美一区二区三区影视| 一片黄亚洲嫩模| 91免费小视频| 自拍偷自拍亚洲精品播放| 国产精品正在播放| 久久久久国产一区二区三区四区| 蜜臀av一区二区在线观看| 欧美老女人在线| 亚洲成人免费看| 91福利国产精品| 亚洲色图欧洲色图| 99热在这里有精品免费| 精品国产乱码久久久久久免费| 免费av成人在线| 91麻豆精品国产91久久久使用方法 | 精品国产露脸精彩对白| 久久激情综合网| 国产精品18久久久久久vr| 日韩一二三区视频| 日韩av中文字幕一区二区三区 | xf在线a精品一区二区视频网站| 日韩精品一级二级 | 欧美国产成人精品| 国产成人自拍网| 中文字幕精品在线不卡| 成人午夜视频免费看| 中文字幕成人av| 91香蕉视频污| 夜夜操天天操亚洲| 欧美日韩国产美女| 日本欧美一区二区| 久久色.com| 成人精品一区二区三区中文字幕| 欧美国产97人人爽人人喊| 99久久久精品| 一区二区三区精品| 9191成人精品久久| 国产一区二区不卡| 欧美激情一区二区三区不卡| 99精品热视频| 亚洲一卡二卡三卡四卡| 欧美一级专区免费大片| 国产在线视频一区二区三区| 国产精品视频第一区| 国产精品不卡在线| 欧美日韩另类国产亚洲欧美一级| 免费人成精品欧美精品| 精品成a人在线观看| 成人av电影观看| 亚洲韩国一区二区三区| 日韩精品专区在线影院重磅| 国产成人免费9x9x人网站视频| 亚洲欧美一区二区视频| 欧美日韩一区二区在线视频| 免费一级欧美片在线观看| 国产日韩影视精品| 欧美亚洲图片小说| 久久99久国产精品黄毛片色诱| 国产人伦精品一区二区| 色美美综合视频| 免费观看在线综合| 国产精品乱人伦| 欧美二区三区的天堂| 国产精品资源在线观看| 一区二区三区欧美在线观看| 精品国产一二三区| 色综合中文字幕| 精品午夜一区二区三区在线观看| 国产精品网站导航| 欧美肥妇bbw| 成人高清在线视频| 日韩电影网1区2区| 国产精品成人一区二区三区夜夜夜| 欧美日韩亚洲不卡| 成人免费观看男女羞羞视频| 亚洲成人动漫av| 国产精品久久久久久久第一福利| 欧美日韩电影在线播放| 国产a久久麻豆| 视频一区二区国产| 国产精品女人毛片| 日韩一区二区视频在线观看| 91原创在线视频| 激情国产一区二区| 午夜精品免费在线| 国产精品污www在线观看| 欧美一级在线视频| 日本丶国产丶欧美色综合| 国产一区二区在线电影| 亚洲国产日韩综合久久精品| 中文字幕在线观看一区二区| 日韩欧美久久一区| 欧美少妇bbb| 91麻豆精品在线观看| 国产精品综合一区二区| 免费国产亚洲视频| 亚洲成人av在线电影| 国产精品久久久久久久久免费桃花 | 欧美日韩大陆在线| 91在线你懂得| 成人免费黄色大片| 极品少妇xxxx精品少妇偷拍| 日韩专区在线视频| 一区二区三区在线观看视频| 国产精品妹子av| 久久婷婷一区二区三区| 欧美一区二区在线不卡| 欧美撒尿777hd撒尿| 91农村精品一区二区在线| 成人网在线免费视频| 国产成人午夜视频| 国产麻豆午夜三级精品| 久久成人久久鬼色| 免费看日韩a级影片| 蜜臀av一区二区在线免费观看| 午夜精品久久久久久久久久 | 粉嫩久久99精品久久久久久夜| 另类小说视频一区二区| 日本麻豆一区二区三区视频|