%description: check NED user-defined math functions (Define_NED_Math_Function() macro) in modules and networks %file: test.ned simple Test { parameters: @isNetwork(true); double p0 = testfunc0(); double p1 = testfunc1(10); double p2 = testfunc2(10, 20); double p3 = testfunc3(10, 20, 30); double p4 = testfunc4(10, 20, 30, 40); } %file: test.cc #include using namespace omnetpp; namespace @TESTNAME@ { double testfunc0() {return 0;} double testfunc1(double a) {return a;} double testfunc2(double a, double b) {return a+b;} double testfunc3(double a, double b, double c) {return a+b+c;} double testfunc4(double a, double b, double c, double d) {return a+b+c+d;} Define_NED_Math_Function(testfunc0,0); Define_NED_Math_Function(testfunc1,1); Define_NED_Math_Function(testfunc2,2); Define_NED_Math_Function(testfunc3,3); Define_NED_Math_Function(testfunc4,4); class Test : public cSimpleModule { public: Test() : cSimpleModule(16384) { } virtual void activity() override; }; Define_Module(Test); #define PRINT_PARAMETER(x) EV << #x << " = " << (double)par(#x) << endl; void Test::activity() { PRINT_PARAMETER( p0 ); PRINT_PARAMETER( p1 ); PRINT_PARAMETER( p2 ); PRINT_PARAMETER( p3 ); PRINT_PARAMETER( p4 ); } }; //namespace %contains: stdout p0 = 0 p1 = 10 p2 = 30 p3 = 60 p4 = 100