2013-08-03 36 views
0

我想用OMNeT ++中的opp_tool測試我的網絡,但是如何包含我自己的類?#includes in OMNeT ++單元測試

我將它寫入%includes:部分(例如我自己的消息子類MyPacket.msg,因此它是#include "MyPacket_m.h"),並將其包含到根目錄中,但沒有任何效果。

我的測試文件:

%description: 
Test file for MyPacket.msg 

%global: 

%file: test.msg 
namespace @[email protected]; 
    class MyPckt{ 
    int packetSizeInByte; 
    .... 
}; 


%includes: 
#include <omnetpp.h> 
#include "test_m.h" 
#include "MyPacket_m.h" // <---- this is the bad guy, how to include it? 

%activity: 

#define PRINT(X) ev << #X << ":" << X << endl 

MyPckt job; 

job.setPacketSizeInByte(255); 
.... 


PRINT(job.getPacketSizeInByte()); 
.... 

%contains: stdout 
job.getPacketSizeInByte():255 
.... 

回答

0

好吧,你可以通過添加絕對路徑(:/omnettpp/workspace/some_projekt/myQueue.h例如C)包含文件。但仍然存在錯誤,儘管代碼是正確的。

首先我在測試文件中寫了代碼,一切都很好。 第二我想包括代碼作爲標題,nothings罰款:(

仍然沒有人有想法?