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
ExampleTestCase.cpp
Package: SwordOnline.rar [view]
Upload User: dzyhzl
Upload Date: 2019-04-29
Package Size: 56270k
Code Size: 1k
Category:
Game Server Simulator
Development Platform:
C/C++
- #include "ExampleTestCase.h"
- void ExampleTestCase::example ()
- {
- assertDoublesEqual (1.0, 1.1, 0.05);
- assert (1 == 0);
- assert (1 == 1);
- }
- void ExampleTestCase::anotherExample ()
- {
- assert (1 == 2);
- }
- void ExampleTestCase::setUp ()
- {
- m_value1 = 2.0;
- m_value2 = 3.0;
- }
- void ExampleTestCase::testAdd ()
- {
- double result = m_value1 + m_value2;
- assert (result == 6.0);
- }
- void ExampleTestCase::testDivideByZero ()
- {
- int zero = 0;
- int result = 8 / zero;
- }
- void ExampleTestCase::testEquals ()
- {
- std::auto_ptr<long> l1 (new long (12));
- std::auto_ptr<long> l2 (new long (12));
- assertLongsEqual (12, 12);
- assertLongsEqual (12L, 12L);
- assertLongsEqual (*l1, *l2);
- assert (12L == 12L);
- assertLongsEqual (12, 13);
- assertDoublesEqual (12.0, 11.99, 0.5);
- }
- Test *ExampleTestCase::suite ()
- {
- TestSuite *testSuite = new TestSuite ("ExampleTestCase");
- testSuite->addTest (new TestCaller <ExampleTestCase> ("anotherExample", anotherExample));
- testSuite->addTest (new TestCaller <ExampleTestCase> ("testAdd", testAdd));
- testSuite->addTest (new TestCaller <ExampleTestCase> ("testDivideByZero", testDivideByZero));
- testSuite->addTest (new TestCaller <ExampleTestCase> ("testEquals", testEquals));
- return testSuite;
- }