%description: Test the cEventHeap optimization using the circular buffer. Messages scheduled for the same simulation time with same prio should be delivered in the order they were scheduled. %file: test.ned simple Test { @isNetwork(true); } %file: test.cc #include using namespace omnetpp; namespace @TESTNAME@ { class Test : public cSimpleModule { public: virtual void initialize() override; virtual void handleMessage(cMessage *msg) override; }; Define_Module(Test); void Test::initialize() { scheduleAt(simTime()+1, new cMessage("timer1")); scheduleAt(simTime()+1, new cMessage("timer2")); cMessage *msg0 = new cMessage("timer0"); msg0->setSchedulingPriority(-1); // should precede previous ones scheduleAt(simTime()+1, msg0); } void Test::handleMessage(cMessage *msg) { EV << "received: " << msg->getName() << endl; if (strcmp(msg->getName(), "timer1") == 0) { // note: these msgs should be delivered AFTER timer2! (because they are // all for T = 1s, and timer2 was scheduled first) scheduleAt(simTime(), new cMessage("zerodelay1")); scheduleAt(simTime(), new cMessage("zerodelay2")); } delete msg; } }; //namespace %contains-regex: stdout received: timer0 .* received: timer1 .* received: timer2 .* received: zerodelay1 .* received: zerodelay2