1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<title>Unit Tests</title>
</head>
<body>
<div class='header'>
<div class='headertitle'>
Unit Tests
</div>
</div>
<div class='contents'>
<p>QuickFIX comes with a comprehensive suite of automated unit
tests. These tests are run by a framework called <a href=
"http://unittest-cpp.sourceforge.net">UnitTest++</a>.
UnitTest++ allows developers to test C++ code by writing code
that calls functions on objects and asserting correct behavior.
These test verifies not only that the code works correctly, but
also that it works the same on all platforms.</p>
<p>This sample shows the setup and execution of the test that
verifies the Parser object can correctly extract messages from
a stream.</p>
<pre class='fragment'>
struct readFixMessageFixture
{
readFixMessageFixture()
{
fixMsg1 = "8=FIX.4.2\0019=12\00135=A\001108=30\00110=31\001";
fixMsg2 = "8=FIX.4.2\0019=17\00135=4\00136=88\001123=Y\00110=34\001";
fixMsg3 = "8=FIX.4.2\0019=19\00135=A\001108=30\0019710=8\00110=31\001";
object.addToStream( fixMsg1 + fixMsg2 + fixMsg3 );
}
std::string fixMsg1;
std::string fixMsg2;
std::string fixMsg3;
Parser object;
};
TEST_FIXTURE(readFixMessageFixture, readFixMessage)
{
std::string readFixMsg1;
CHECK( object.readFixMessage( readFixMsg1 ) );
CHECK_EQUAL( fixMsg1, readFixMsg1 );
std::string readFixMsg2;
CHECK( object.readFixMessage( readFixMsg2 ) );
CHECK_EQUAL( fixMsg2, readFixMsg2 );
std::string readFixMsg3;
CHECK( object.readFixMessage( readFixMsg3 ) );
CHECK_EQUAL( fixMsg3, readFixMsg3 );
}
</pre>
</div>
</body>
</html>
|