⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synchronizedtestresult.h

📁 C++ class libraries for network-centric, portable applications, integrated perfectly with the C++ St
💻 H
字号:
#ifndef SYNCHRONIZEDTESTRESULTDECORATOR_H#define SYNCHRONIZEDTESTRESULTDECORATOR_H#include <afxmt.h>#include "TestResultDecorator.h"class SynchronizedTestResult : public TestResultDecorator{public:								SynchronizedTestResult (TestResult *result);								~SynchronizedTestResult ();	bool						shouldStop	();	void						addError	(Test *test, CppUnitException *e);	void						addFailure	(Test *test, CppUnitException *e);	void						startTest	(Test *test);	void						endTest		(Test *test);	int							runTests	();	int							testErrors  ();	int							testFailures ();	bool						wasSuccessful ();	void						stop ();	vector<TestFailure *>&		errors ();	vector<TestFailure *>&		failures ();private:	CCriticalSection			m_criticalSection;};// Constructorinline SynchronizedTestResult::SynchronizedTestResult (TestResult *result): TestResultDecorator (result) {}// Destructorinline SynchronizedTestResult::~SynchronizedTestResult (){}// Returns whether the test should stopinline bool SynchronizedTestResult::shouldStop (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->shouldStop (); }// Adds an error to the list of errors. The passed in exception// caused the errorinline void SynchronizedTestResult::addError (Test *test, CppUnitException *e){ CSingleLock sync (&m_criticalSection, TRUE); m_result->addError (test, e); }// Adds a failure to the list of failures. The passed in exception// caused the failure.inline void SynchronizedTestResult::addFailure (Test *test, CppUnitException *e){ CSingleLock sync (&m_criticalSection, TRUE); m_result->addFailure (test, e); }// Informs the result that a test will be started.inline void SynchronizedTestResult::startTest (Test *test){ CSingleLock sync (&m_criticalSection, TRUE); m_result->startTest (test); }// Informs the result that a test was completed.inline void SynchronizedTestResult::endTest (Test *test){ CSingleLock sync (&m_criticalSection, TRUE); m_result->endTest (test); }// Gets the number of run tests.inline int SynchronizedTestResult::runTests (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->runTests (); }// Gets the number of detected errors.inline int SynchronizedTestResult::testErrors (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->testErrors (); }// Gets the number of detected failures.inline int SynchronizedTestResult::testFailures (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->testFailures (); }// Returns whether the entire test was successful or not.inline bool SynchronizedTestResult::wasSuccessful (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->wasSuccessful (); }// Marks that the test run should stop.inline void SynchronizedTestResult::stop (){ CSingleLock sync (&m_criticalSection, TRUE); m_result->stop (); }// Returns a vector of the errors.inline vector<TestFailure *>& SynchronizedTestResult::errors (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->errors (); }// Returns a vector of the failures.inline vector<TestFailure *>& SynchronizedTestResult::failures (){ CSingleLock sync (&m_criticalSection, TRUE); return m_result->failures (); }#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -