-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestLogger.h
More file actions
81 lines (73 loc) · 2.35 KB
/
Copy pathtestLogger.h
File metadata and controls
81 lines (73 loc) · 2.35 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef _LOG_TESTS_HEADER_
#define _LOG_TESTS_HEADER_
#include <string>
#include <cppunit/extensions/HelperMacros.h>
#include "Common.h"
/*
* A test case to test LogEngine Log class
*
*/
class LoggerTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE( LoggerTest );
CPPUNIT_TEST( testLog0 );
CPPUNIT_TEST( testLog1 );
CPPUNIT_TEST( testLog2 );
CPPUNIT_TEST(testLog3);
CPPUNIT_TEST( testLog4 );
CPPUNIT_TEST(testLogTwoSinksOneFileLock);
CPPUNIT_TEST(testLogTwoSinksOneFile);
CPPUNIT_TEST( testLogMultiSink1 );
CPPUNIT_TEST( testLogMultiSink2 );
CPPUNIT_TEST( testLogMultiSink3 );
CPPUNIT_TEST( testLogStrategyNone );
CPPUNIT_TEST(testLogStrategySingle);
CPPUNIT_TEST(testLogStrategyTimeStamp);
CPPUNIT_TEST(testLogStrategyBakNumber);
CPPUNIT_TEST( testLogStatistic );
CPPUNIT_TEST(testGetFileLogger);
CPPUNIT_TEST(testGetStdoutLogger);
CPPUNIT_TEST(testGetStderrLogger);
CPPUNIT_TEST(testLogPerfromanceST1);
CPPUNIT_TEST(testLogPerfromanceST2);
CPPUNIT_TEST(testLogPerfromanceMT1);
CPPUNIT_TEST(testLogPerfromanceLock1);
/* CPPUNIT_TEST( testLogRotation1 );*/
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
void tearDown();
void testLog0();
void testLog1();
void testLog2();
void testLog3();
void testLog4();
void testLogTwoSinksOneFile();
void testLogTwoSinksOneFileLock();
void testLogMultiSink1();
void testLogMultiSink2();
void testLogMultiSink3();
void testLogStrategyNone();
void testLogStrategySingle();
void testLogStrategyTimeStamp();
void testLogStrategyBakNumber();
void testLogStatistic();
void testGetFileLogger();
void testGetStdoutLogger();
void testGetStderrLogger();
void testLogPerfromanceST1();
void testLogPerfromanceST2();
void testLogPerfromanceMT1();
void testLogPerfromanceLock1();
// void testLogRotation1();
};
inline std::string cutLog(std::string str) // cut off time and thread information (which is not same time from time)
{
// # is a marker of ThreadID in log line pattern, because ':' can be present in TimeMacro as well (goes before ThreadMacro).
// ':' is a divider before MsgMacro
size_t pos = str.find_first_of('#', 1);
pos = str.find_first_of(':', pos + 1);
if (pos == std::string::npos) return str;
return DelCRLF(str.erase((size_t)1, pos+1));
}
#endif // _LOG_TESTS_HEADER_