Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
S3PTestCard.cpp
Package: SwordOnline.rar [view]
Upload User: dzyhzl
Upload Date: 2019-04-29
Package Size: 56270k
Code Size: 3k
Category:
Game Server Simulator
Development Platform:
C/C++
- // S3PTestCard.cpp: implementation of the S3PTestCard class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "S3PTestCard.h"
- #include "S3PCard.h"
- #include "S3PRow.h"
- #include <iostream.h>
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- S3PTestCard::~S3PTestCard()
- {
- }
- void S3PTestCard::testCardInit()
- {
- ColumnAndValue cav;
- cav["iid"] = "1";
- cav["ccardcode"] = "0001";
- cav["ccardpassword"] = "12345";
- cav["iflag"] = "1";
- cav["iholdsecond"] = "1000";
- cav["iholdmonth"] = "12";
- S3PCard * card = new S3PCard(cav);
- S3PCard * cardInTable = new S3PCard(1,"0001");
- ColumnAndValue cavInTable = cardInTable->getCardProp();
- cout << "Card Code is:" << cavInTable["ccardcode"].c_str() << endl;
- assert(cav == cavInTable);
- delete card;
- delete cardInTable;
- }
- void S3PTestCard::testRemove()
- {
- ColumnAndValue cav;
- cav["iid"] = "2";
- cav["ccardcode"] = "0002";
- cav["ccardpassword"] = "12345";
- cav["iflag"] = "2";
- cav["iholdsecond"] = "1200";
- cav["iholdmonth"] = "21";
- S3PCard * card = new S3PCard(cav);
- cav.clear();
- delete card;
- S3PCard * cardOld = new S3PCard(2,"2");
- ColumnAndValue cavInfo = cardOld->getCardProp();
- cout <<"testRemove: Card code is ==>" << cavInfo["ccordcode"].c_str() << endl;
- cavInfo.clear();
- int iReturn = cardOld->remove();
- if ( iReturn < 0 )
- {
- assert(false);
- }
- delete cardOld;
- }
- void S3PTestCard::testCardSetInfo()
- {
- ColumnAndValue cav;
- cav["iid"] = "1";
- cav["ccardcode"] = "0001";
- cav["iholdsecond"] = "2400";
- S3PCard * card = new S3PCard(1,"0001");
- ColumnAndValue cavInfo = card->getCardProp();
- cout << "testSetInfo: Card code first is ==>" << cavInfo["ccardcode"].c_str() << endl;
- card->setCardProp(cav);
- cavInfo = card->getCardProp();
- cout << "testSetInfo: Card code last is ==>" << cavInfo["ccardcode"].c_str() << endl;
- cout << " Card iHoldsecond is ===>" << cavInfo["iholdsecond"].c_str() << endl;
- cavInfo.clear();
- delete card;
- }
- void S3PTestCard::testGetCardList()
- {
- std::list<ColumnAndValue> lstResult;
- lstResult = S3PCard::getCardList(0);
- while (!lstResult.empty())
- {
- ColumnAndValue cav = lstResult.front();
- cout << "testGetCardList is ====>" << cav["ccardcode"].c_str() << endl;
- lstResult.pop_front();
- }
- lstResult.clear();
- }
- Test *S3PTestCard::suite ()
- {
- TestSuite *testSuite = new TestSuite ("Test Card Object:");
- //testSuite->addTest (new TestCaller <S3PTestCard> ("testCardInit", testCardInit));
- //testSuite->addTest (new TestCaller <S3PTestCard> ("testCardGetInfo", testCardSetInfo));
- //testSuite->addTest (new TestCaller <S3PTestCard> ("testRemove", testRemove));
- testSuite->addTest (new TestCaller <S3PTestCard> ("testGetCardList", testGetCardList));
- return testSuite;
- }
- void S3PTestCard::setUp()
- {
- }