00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023
00024
00025
00026
00027
00028 #include <string>
00029 #include "TestToolBox/IEventReceiver.h"
00030 #include "TestToolBox/CommonSources/ObjectLock.h"
00031
00032
00033 #ifdef USE_TEST_INSTANCE_DLL
00034 # include "TestToolBox/TestInstanceDll.h"
00035 #endif
00036
00037 #pragma warning( push )
00038 #pragma warning( disable : 4996 ) // vsprintf declared deprecated
00039
00040 namespace TestToolBox
00041 {
00042
00043 class CheckerForMultipleSequences;
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #define TTB_CMD(method) \
00054 TestToolBox::TestEvents::Get()->Command (#method); \
00055 method ();
00056 #define TTB_CMD1(method,p1) \
00057 TestToolBox::TestEvents::Get()->Command (#method, #p1); \
00058 method ( p1 );
00059 #define TTB_CMD2(method,p1,p2) \
00060 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2); \
00061 method ( p1, p2 );
00062 #define TTB_CMD3(method,p1,p2,p3) \
00063 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3); \
00064 method ( p1, p2, p3 );
00065 #define TTB_CMD4(method,p1,p2,p3,p4) \
00066 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4); \
00067 method ( p1, p2, p3, p4 );
00068 #define TTB_CMD5(method,p1,p2,p3,p4,p5) \
00069 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5); \
00070 method ( p1, p2, p3, p4, p5 );
00071 #define TTB_CMD6(method,p1,p2,p3,p4,p5,p6) \
00072 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6); \
00073 method ( p1, p2, p3, p4, p5, p6 );
00074 #define TTB_CMD7(method,p1,p2,p3,p4,p5,p6,p7) \
00075 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6 " " #p7); \
00076 method ( p1, p2, p3, p4, p5, p6, p7 );
00077 #define TTB_CMD8(method,p1,p2,p3,p4,p5,p6,p7,p8) \
00078 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6 " " #p7 " " #p8); \
00079 method ( p1, p2, p3, p4, p5, p6, p7, p8 );
00080 #define TTB_CMD9(method,p1,p2,p3,p4,p5,p6,p7,p8,p9) \
00081 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6 " " #p7 " " #p8 " " #p9); \
00082 method ( p1, p2, p3, p4, p5, p6, p7, p8, p9 );
00083 #define TTB_CMD10(method,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
00084 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6 " " #p7 " " #p8 " " #p9 " " #p10); \
00085 method ( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 );
00086 #define TTB_CMD11(method,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11) \
00087 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6 " " #p7 " " #p8 " " #p9 " " #p10 " " #p11); \
00088 method ( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 );
00089 #define TTB_CMD12(method,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12) \
00090 TestToolBox::TestEvents::Get()->Command (#method, #p1 " " #p2 " " #p3 " " #p4 " " #p5 " " #p6 " " #p7 " " #p8 " " #p9 " " #p10 " " #p11 " " #p12); \
00091 method ( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
00092
00093
00094
00095
00096
00097
00098
00099
00100 #define TTB_ACT_S(expression) \
00101 {\
00102 std::ostringstream oss; \
00103 oss << expression; \
00104 TestToolBox::TestEvents::Get()->Act (oss.str().c_str()); \
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 #define TTB_EXP_S(expression) \
00136 {\
00137 std::ostringstream oss; \
00138 oss << expression; \
00139 TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,oss.str().c_str()); \
00140 }
00141
00142 #define TTB_EXP(stringValue) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,stringValue)
00143 #define TTB_EXP1(formatString,p1) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1)
00144 #define TTB_EXP2(formatString,p1,p2) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1,p2)
00145 #define TTB_EXP3(formatString,p1,p2,p3) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1,p2,p3)
00146 #define TTB_EXP4(formatString,p1,p2,p3,p4) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1,p2,p3,p4)
00147 #define TTB_EXP5(formatString,p1,p2,p3,p4,p5) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5)
00148 #define TTB_EXP6(formatString,p1,p2,p3,p4,p5,p6) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5,p6)
00149 #define TTB_EXP7(formatString,p1,p2,p3,p4,p5,p6,p7) TestToolBox::TestEvents::Get()->ExpectResult (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5,p6,p7)
00150
00151
00152
00153
00154
00155
00156 #define TTB_EXP_SEQ_S(expression) \
00157 {\
00158 std::ostringstream oss; \
00159 oss << expression; \
00160 TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,oss.str().c_str()); \
00161 }
00162 #define TTB_EXP_SEQ(stringValue) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,stringValue)
00163 #define TTB_EXP_SEQ1(formatString,p1) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1)
00164 #define TTB_EXP_SEQ2(formatString,p1,p2) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1,p2)
00165 #define TTB_EXP_SEQ3(formatString,p1,p2,p3) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1,p2,p3)
00166 #define TTB_EXP_SEQ4(formatString,p1,p2,p3,p4) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1,p2,p3,p4)
00167 #define TTB_EXP_SEQ5(formatString,p1,p2,p3,p4,p5) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5)
00168 #define TTB_EXP_SEQ6(formatString,p1,p2,p3,p4,p5,p6) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5,p6)
00169 #define TTB_EXP_SEQ7(formatString,p1,p2,p3,p4,p5,p6,p7) TestToolBox::TestEvents::Get()->ExpectResultSequential (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5,p6,p7)
00170
00171
00172
00173
00174
00175
00176 #define TTB_EXP_VAR_S(expression) \
00177 {\
00178 std::ostringstream oss; \
00179 oss << expression; \
00180 TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,oss.str().c_str()); \
00181 }
00182 #define TTB_EXP_VAR(stringValue) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,stringValue)
00183 #define TTB_EXP_VAR1(formatString,p1) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1)
00184 #define TTB_EXP_VAR2(formatString,p1,p2) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1,p2)
00185 #define TTB_EXP_VAR3(formatString,p1,p2,p3) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1,p2,p3)
00186 #define TTB_EXP_VAR4(formatString,p1,p2,p3,p4) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1,p2,p3,p4)
00187 #define TTB_EXP_VAR5(formatString,p1,p2,p3,p4,p5) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5)
00188 #define TTB_EXP_VAR6(formatString,p1,p2,p3,p4,p5,p6) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5,p6)
00189 #define TTB_EXP_VAR7(formatString,p1,p2,p3,p4,p5,p6,p7) TestToolBox::TestEvents::Get()->ExpectResultVariable (__FILE__,__LINE__,formatString,p1,p2,p3,p4,p5,p6,p7)
00190
00191
00192
00193
00194
00195
00196
00197 #define TTB_CHECK_COND(expression) \
00198 TestToolBox::TestEvents::Get()->CheckCondition( __FILE__,__LINE__, #expression, expression);
00199
00200 #define TTB_CHECK_EQUAL(left,right) \
00201 TestToolBox::TestEvents::Get()->CheckEqual( __FILE__,__LINE__, #left, left, #right, right);
00202
00203 #define TTB_CHECK(left, op, right) \
00204 TestToolBox::TestEvents::Get()->Check(__FILE__,__LINE__,#left,left,#op,op,#right,right);
00205
00206
00207
00208
00209
00210
00211
00212
00213 #define TTB_INFO(message) TestToolBox::TestEvents::Get()->Info (message)
00214
00215
00216 #define TTB_SECTION(sectionName) TestToolBox::TestEvents::Get()->Section (sectionName)
00217
00218
00219 #define TTB_LIST_ALL_STORED_EVENTS() TestToolBox::TestEvents::Get()->ListAllStoredEvents (__FILE__,__LINE__)
00220
00221
00222 #define TTB_CHECK_FOR_UNEXPECTED_EVENTS() TestToolBox::TestEvents::Get()->CheckForUnexpectedEvents ("explicit check", __FILE__,__LINE__)
00223
00224
00225
00226 #define TTB_CHECK_DEFINED_SEQUENCES() TestToolBox::TestEvents::Get()->CheckDefinedSequences (__FILE__,__LINE__)
00227
00228
00229
00230
00231
00232
00233
00234 #define TTB_CHECK_SECTION() \
00235 BOOST_CHECK((TTB::TestEvents::Get()->CurTestIsStillOk())); \
00236 TestToolBox::TestEvents::Get()->CheckForUnexpectedEvents ("explicit check", __FILE__,__LINE__); \
00237 BOOST_MESSAGE("\n---- TEST_EVENT check section\n"); \
00238 TestToolBox::TestEvents::Get()->StartNewTestCase("TEST_EVENT next test case");
00239
00240 #define TTB_NEXT_SECTION(infoAboutNextSection) \
00241 BOOST_CHECK((TTB::TestEvents::Get()->CurTestIsStillOk())); \
00242 TestToolBox::TestEvents::Get()->CheckForUnexpectedEvents ("explicit check", __FILE__,__LINE__); \
00243 BOOST_MESSAGE("\n---- TEST_EVENT next section: " #infoAboutNextSection "\n"); \
00244 TestToolBox::TestEvents::Get()->StartNewTestCase("TEST_EVENT next test case");
00245
00246
00247 struct IEventReceiver;
00248 struct IProtocol;
00249 class TestEvents;
00250 class EventPosition;
00251
00252
00253
00254
00255
00256
00257 namespace CheckType
00258 {
00259 enum Enum
00260 {
00261
00262 eNOT_SET,
00263
00264
00265 eSTRICT,
00266
00267
00268
00269 eSEQUENTIAL,
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281 eMULTIPLE_SEQUENCES,
00282
00283
00284 eVARIABLE
00285 };
00286 }
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 class EventPosition
00297 {
00298 public:
00299 EventPosition()
00300 : m_position (-1)
00301 {}
00302 EventPosition (int in_pos)
00303 : m_position (in_pos)
00304 {}
00305 EventPosition (std::vector<int>::size_type in_sizePos)
00306 : m_position (static_cast<int>(in_sizePos))
00307 {}
00308
00309 void Reset (void)
00310 {m_position = -1;}
00311
00312 operator int() const
00313 {return m_position;}
00314
00315 void StorePos (int & out_rPos)
00316 {out_rPos = m_position;}
00317
00318 bool IsOk (void)
00319 {return m_position >= 0;}
00320
00321 private:
00322 int m_position;
00323 };
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335 class TestEvents : public AutoCriticalSection, public IEventReceiver
00336 {
00337 private:
00338
00339
00340
00341 explicit TestEvents (void);
00342
00343 public:
00344
00345 std::string const S_UNEXPECTED_EVENTS;
00346 std::string const S_EVENT_NOT_FOUND;
00347 std::string const S_EXPECTED;
00348 std::string const S_FOUND;
00349 std::string const S_SEPARATOR_LINE_1;
00350 std::string const S_SEPARATOR_LINE_2;
00351
00352
00353
00354
00355 ~TestEvents();
00356
00357
00358 #ifdef USE_TEST_INSTANCE_DLL
00359 static TestEvents* CreateNewInstanceForUsageInDll(void){return new TestEvents;};
00360 static TestEvents* Get (void)
00361 {return TTB_GetInstance_TestEvents();}
00362 static void Cleanup (void)
00363 {TTB_CleanupInstance_TestEvents();}
00364 #else
00365 static TestEvents* Get (void)
00366 {if (!s_pTestEvents) s_pTestEvents = new TestEvents;
00367 return s_pTestEvents;}
00368 static TestEvents* s_pTestEvents;
00369 static void Cleanup (void)
00370 {delete s_pTestEvents; s_pTestEvents = 0;}
00371 #endif
00372
00373
00374 void ConnectWithEventReceiver (IEventReceiver* in_pIEventReceiver)
00375 {m_pIEventReceiver = in_pIEventReceiver;}
00376
00377 void ConnectWithProtocol (IProtocol* in_pIProtocol)
00378 {m_pIProtocol = in_pIProtocol;}
00379
00380
00381
00382 void SetWidthCommandNameInLogFile (int in_width)
00383 {m_widthCommandNameInLogFile = in_width;}
00384
00385
00386
00387
00388
00389
00390
00391
00392 virtual void EventMsg(
00393 EventContext,
00394 const char* in_eventDescription)
00395 {Act(in_eventDescription);}
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413 void Act (const char* in_actualEvent, ...);
00414
00415
00416 void ActualResult (const char* in_actualEvent, ...);
00417
00418
00419 void Act (std::string const & in_actualEvent)
00420 {Act(in_actualEvent.c_str());}
00421
00422
00423
00424
00425
00426
00427
00428 EventPosition ExpectResult(
00429 const char* in_fileName,
00430 const long in_lineNum,
00431 const char* in_expectedEvent, ...);
00432
00433
00434
00435 EventPosition ExpectResultSequential(
00436 const char* in_fileName,
00437 const long in_lineNum,
00438 const char* in_expectedEvent, ...);
00439
00440
00441
00442 EventPosition ExpectResultVariable(
00443 const char* in_fileName,
00444 const long in_lineNum,
00445 const char* in_expectedEvent, ...);
00446
00447
00448
00449
00450
00451
00452 void CheckForUnexpectedEvents (
00453 const char* in_context,
00454 const char* in_fileName = 0,
00455 const long in_lineNum = 0);
00456
00457
00458
00459 void ResetCurrentCheckPosition (void);
00460
00461
00462 void SetCurrentCheckPosition (int in_newPos);
00463
00464
00465 int GetCurrentCheckPosition (void);
00466
00467
00468 void ListAllStoredEvents (
00469 const char* in_fileName = 0,
00470 const long in_lineNum = 0,
00471 CheckType::Enum in_checkType = CheckType::eNOT_SET);
00472
00473
00474
00475
00476
00477
00478
00479 void ClearAllStoredEvents (void);
00480
00481
00482 void SetCheckType (CheckType::Enum in_mode)
00483 {m_checkType = in_mode;}
00484
00485
00486 void ResetCheckType (void)
00487 {m_checkType = CheckType::eNOT_SET;}
00488
00489
00490 CheckType::Enum GetCheckType (void)
00491 {return m_checkType;}
00492
00493
00494 std::string GetCheckTypeAsText (CheckType::Enum in_checkType);
00495
00496
00497
00498 EventPosition GetLastEventPosition (void)
00499 {return m_positionOfLastEvent;}
00500
00501
00502
00503
00504
00505
00506
00507
00508 void SetDetailedLog (
00509 bool in_state,
00510 std::string const & in_prefixAct = "")
00511 {m_detailedLog = in_state; m_actLogPrefix = in_prefixAct;}
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522 void DefineSequence (std::string const & in_nameSequence);
00523
00524
00525 void StoreExpectedEventWithinSelectedSequence(
00526 std::string const & in_expectedEvent,
00527 const char* in_fileName,
00528 const long in_lineNum);
00529
00530
00531
00532 void CheckDefinedSequences (
00533 const char* in_fileName = 0,
00534 const long in_lineNum = 0);
00535
00536
00537 void SetDetailedLogSequences (bool in_detailedLog);
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555 bool CheckCondition (
00556 const char* in_fileName,
00557 const long in_lineNum,
00558 std::string const & in_expressionAsText,
00559 bool in_expressionValue);
00560
00561
00562
00563
00564
00565 template <typename T>
00566 bool CheckEqual(
00567 const char* in_fileName,
00568 const long in_lineNum,
00569 std::string const & in_leftExpressionAsText,
00570 T const & in_leftExpressionValue,
00571 std::string const & in_rightExpressionAsText,
00572 T const & in_rightExpressionValue)
00573 {
00574 bool errorFound = (in_leftExpressionValue != in_rightExpressionValue);
00575
00576
00577 DisplayCheckInfo (
00578 in_fileName, in_lineNum,
00579 "CheckEqual", errorFound,
00580 in_leftExpressionAsText, ToString(in_leftExpressionValue),
00581 in_rightExpressionAsText, ToString(in_rightExpressionValue),
00582 "==", typeid(in_leftExpressionValue).name());
00583
00584 return errorFound;
00585 }
00586
00587
00588
00589
00590
00591
00592 bool CheckEqual(
00593 const char* in_fileName,
00594 const long in_lineNum,
00595 std::string const & in_leftExpressionAsText,
00596 double const & in_leftExpressionValue,
00597 std::string const & in_rightExpressionAsText,
00598 double const & in_rightExpressionValue);
00599
00600
00601
00602
00603
00604
00605
00606 template <typename T, typename CompareOp>
00607 bool Check(
00608 const char* in_fileName,
00609 const long in_lineNum,
00610 std::string const & in_leftExpressionAsText,
00611 T const & in_leftExpressionValue,
00612 std::string const & in_compareOpAsText,
00613 CompareOp & in_compareOp,
00614 std::string const & in_rightExpressionAsText,
00615 T const & in_rightExpressionValue)
00616 {
00617
00618 bool errorFound = !in_compareOp(
00619 in_leftExpressionValue,in_rightExpressionValue);
00620
00621
00622 DisplayCheckInfo (
00623 in_fileName, in_lineNum,
00624 "Check", errorFound,
00625 in_leftExpressionAsText, ToString(in_leftExpressionValue),
00626 in_rightExpressionAsText, ToString(in_rightExpressionValue),
00627 in_compareOpAsText, typeid(in_leftExpressionValue).name());
00628
00629 return errorFound;
00630 }
00631
00632
00633
00634 void SetDoublePrecision (int in_precision)
00635 {m_doublePrecision = in_precision;}
00636
00637
00638
00639 int GetDoublePrecision (void)
00640 {return m_doublePrecision;}
00641
00642
00643
00644
00645 void SetDetailedCheckLog (bool in_detailedLog)
00646 {m_detailedCheckLog = in_detailedLog;}
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657 void StartNewTestCase (
00658 const std::string& in_rDescTestCase);
00659
00660
00661 void Command (
00662 std::string const & in_cmd,
00663 std::string const & in_params = "");
00664
00665
00666 void Info (
00667 std::string const & in_info);
00668
00669
00670
00671 void Section (
00672 std::string const & in_sectionName);
00673
00674
00675
00676 void GenerateErrorMessage (
00677 const char* in_fileName,
00678 const long in_lineNum,
00679 std::string const & in_errorInfo);
00680
00681
00682
00683 bool CheckForUnexpectedEvents (
00684 std::string& out_rResult);
00685
00686
00687 void ListAllStoredEvents (
00688 std::string& out_rListOfEvents);
00689
00690
00691 void AddTestEvent (
00692 const std::string& in_rEvent);
00693
00694
00695 EventPosition CheckForTestEvent(
00696 const std::string& in_rEvent,
00697 std::string& out_rResult1,
00698 std::string& out_rResult2);
00699
00700
00701
00702 EventPosition CheckForTestEventSequential(
00703 const std::string& in_rEvent,
00704 std::string& out_rResult1,
00705 std::string& out_rResult2);
00706
00707
00708
00709 EventPosition CheckForTestEventVariable(
00710 const std::string& in_rEvent,
00711 std::string& out_rResult1,
00712 std::string& out_rResult2);
00713
00714
00715 bool AllTestsHaveSucceeded (void)
00716 {return m_numFailedTests == 0;}
00717
00718
00719 bool GetTestResult (
00720 long& out_rNumPerformedTests,
00721 long& out_rNumFailedTests,
00722 std::string& out_rDescFirstFailedTest,
00723 std::string& out_rDescError);
00724
00725
00726 bool CurTestIsStillOk (void)
00727 {return m_curTestStillOk;}
00728
00729
00730 std::string GetDescCurTest (void)
00731 {return m_descCurrentTest;}
00732
00733
00734 void Reset (void);
00735
00736
00737
00738 private:
00739
00740
00741 struct FirstError
00742 {
00743 bool m_exists;
00744 long m_idxFirstFailedTest;
00745 std::string m_descFirstFailedTest;
00746 std::string m_descError;
00747 FirstError() : m_exists (false), m_idxFirstFailedTest(0){}
00748 };
00749
00750
00751 FirstError m_firstError;
00752
00753
00754
00755
00756
00757
00758 typedef std::vector<std::pair <bool, std::string> > Events;
00759
00760
00761 Events m_events;
00762
00763
00764 Events::size_type m_curCheckPos;
00765
00766
00767
00768 EventPosition m_positionOfLastEvent;
00769
00770
00771 std::string m_actLogPrefix;
00772
00773
00774
00775 bool m_active;
00776
00777
00778
00779
00780 bool m_checkForUnexpected;
00781
00782
00783
00784
00785 bool m_detailedLog;
00786
00787
00788
00789 bool m_detailedCheckLog;
00790
00791
00792 CheckType::Enum m_checkType;
00793
00794
00795
00796 int m_doublePrecision;
00797
00798
00799 bool m_curTestStillOk;
00800
00801
00802 long m_numPerformedTests;
00803
00804
00805 long m_numFailedTests;
00806
00807
00808 std::string m_descCurrentTest;
00809
00810
00811
00812 int m_widthCommandNameInLogFile;
00813
00814
00815 IEventReceiver* m_pIEventReceiver;
00816
00817
00818 IProtocol* m_pIProtocol;
00819
00820
00821 CheckerForMultipleSequences* m_pCheckerForMultipleSequences;
00822
00823 friend class EventPosition;
00824
00825 private:
00826
00827
00828
00829
00830
00831
00832 void IncrementCurPos (void);
00833
00834
00835
00836
00837 void StoreError (
00838 const std::string& in_rErrStr1,
00839 const std::string& in_rErrStr2);
00840
00841
00842
00843
00844 EventPosition TestEvents::ExpectResultInternal(
00845 const char* in_fileName,
00846 const long in_lineNum,
00847 const char* in_formattedResult,
00848 CheckType::Enum in_checkType);
00849
00850
00851 void DisplayCheckInfo (
00852 const char* in_fileName,
00853 const long in_lineNum,
00854 std::string const & in_checkType,
00855 bool in_checkFailed,
00856 std::string const & in_paramLeftAsText,
00857 std::string const & in_paramValLeftAsText,
00858 std::string const & in_paramRightAsText = "",
00859 std::string const & in_paramValRightAsText = "",
00860 std::string const & in_compareOpAsText = "",
00861 std::string const & in_paramTypeAsText = "");
00862
00863 void WriteEventEntry (
00864 int in_idxEvent,
00865 std::ostringstream & io_stream,
00866 std::string const & in_prefix = "");
00867
00868 friend class CheckerForMultipleSequences;
00869
00870
00871
00872 };
00873
00874
00875
00876
00877 #ifndef USE_TEST_INSTANCE_DLL
00878 __declspec(selectany) TestEvents* TestEvents::s_pTestEvents = 0;
00879 #endif
00880
00881
00882
00883
00884
00885
00886 static TestEvents* TheTestEvents (void)
00887 {return TestEvents::Get();}
00888
00889 };
00890
00891
00892 #pragma warning( pop )
00893
00894