1*2f083884Ss.makeev_local #ifndef UNITTEST_SCOPEDCURRENTTEST_H
2*2f083884Ss.makeev_local #define UNITTEST_SCOPEDCURRENTTEST_H
3*2f083884Ss.makeev_local 
4*2f083884Ss.makeev_local #include "UnitTest++/CurrentTest.h"
5*2f083884Ss.makeev_local #include <cstddef>
6*2f083884Ss.makeev_local 
7*2f083884Ss.makeev_local class ScopedCurrentTest
8*2f083884Ss.makeev_local {
9*2f083884Ss.makeev_local public:
ScopedCurrentTest()10*2f083884Ss.makeev_local 	ScopedCurrentTest()
11*2f083884Ss.makeev_local 		: m_oldTestResults(UnitTest::CurrentTest::Results())
12*2f083884Ss.makeev_local 		, m_oldTestDetails(UnitTest::CurrentTest::Details())
13*2f083884Ss.makeev_local 	{
14*2f083884Ss.makeev_local 	}
15*2f083884Ss.makeev_local 
16*2f083884Ss.makeev_local 	explicit ScopedCurrentTest(UnitTest::TestResults& newResults, const UnitTest::TestDetails* newDetails = NULL)
m_oldTestResults(UnitTest::CurrentTest::Results ())17*2f083884Ss.makeev_local 		: m_oldTestResults(UnitTest::CurrentTest::Results())
18*2f083884Ss.makeev_local 		, m_oldTestDetails(UnitTest::CurrentTest::Details())
19*2f083884Ss.makeev_local 	{
20*2f083884Ss.makeev_local 		UnitTest::CurrentTest::Results() = &newResults;
21*2f083884Ss.makeev_local 
22*2f083884Ss.makeev_local 		if (newDetails != NULL)
23*2f083884Ss.makeev_local 			UnitTest::CurrentTest::Details() = newDetails;
24*2f083884Ss.makeev_local 	}
25*2f083884Ss.makeev_local 
~ScopedCurrentTest()26*2f083884Ss.makeev_local 	~ScopedCurrentTest()
27*2f083884Ss.makeev_local 	{
28*2f083884Ss.makeev_local 		UnitTest::CurrentTest::Results() = m_oldTestResults;
29*2f083884Ss.makeev_local 		UnitTest::CurrentTest::Details() = m_oldTestDetails;
30*2f083884Ss.makeev_local 	}
31*2f083884Ss.makeev_local 
32*2f083884Ss.makeev_local private:
33*2f083884Ss.makeev_local 	UnitTest::TestResults* m_oldTestResults;
34*2f083884Ss.makeev_local 	const UnitTest::TestDetails* m_oldTestDetails;
35*2f083884Ss.makeev_local };
36*2f083884Ss.makeev_local 
37*2f083884Ss.makeev_local #endif
38