WEB开发网
开发学院手机开发Symbian 开发 在 Symbian S60 平台进行单元测试 阅读

在 Symbian S60 平台进行单元测试

 2010-03-16 17:18:00 来源:WEB开发网   
核心提示:* Understand for C++附录A TestSource.cpp1 #include "TestHeader.h"2 #include "TestDriver.h"3 #include "Logger.h"4 #include "cmap

* Understand for C++

附录A TestSource.cpp

1 #include "TestHeader.h"

2 #include "TestDriver.h"

3 #include "Logger.h"

4 #include "cmapexamplesmsengine.h"

5 #include

6

7 // ========== logger ==========

8 #include

9 #define __DEFINE_LITERAL(aLiteralName, aStr) _LIT(aLiteralName, aStr);

10 _LIT( _KLogDir, "MyLogs" );

11 _LIT( _KLogFile, "test.txt" );

12 #define _LOGF( aEllipsis )

13 {

14 _LIT(_KFormat,"%S(%d):%Ld:%S: ");

15 __DEFINE_LITERAL( _KFile, __FILE__ );

16 TPtrC8 _func8((TUint8*)__FUNCTION__);

17 TBuf<40> _func;

18 _func.Copy(_func8.Right(40));

19 TBuf<256> _log;

20 _log.Format(_KFormat, &_KFile, __LINE__, RThread().Id().Id(), &_func);

21 _log.AppendFormat aEllipsis;

22 RFileLogger::Write( _KLogDir, _KLogFile, EFileLoggingModeAppend, _log );

23 }

24 #define _HERE() _LOGF((KNullDesC))

25

26 // ========== stubbed / mocked implementations ==========

27 class DummyObserver : public MSmsEngineObserver

28 {

29 virtual void MessageSent()

30 {

31 _LOGF((_L("DummyObserver::MessageSent()")));

32 }

33 virtual void MessageReceived(TDesC& aMsg, TDesC& aAddr)

34 {

35 _LOGF((_L("DummyObserver::MessageReceived(%S, %S)"), &aMsg, &aAddr));

36 }

37 virtual void MessageRequested(TDesC& aMsg, TDesC& aAddr)

38 {

39 _LOGF((_L("DummyObserver::MessageRequested(%S, %S)"), &aMsg, &aAddr));

40 }

41 virtual void SmsEngineError(TInt aErrorCode)

42 {

43 _LOGF((_L("DummyObserver::SmsEngineError(%d)"), aErrorCode));

上一页  6 7 8 9 10 11 12 13 14 15  下一页

Tags:Symbian 平台 进行

编辑录入:coldstar [复制链接] [打 印]
赞助商链接