mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 18:13:57 +02:00
WIP: Add tests for isl-mock-channel
This commit is contained in:
parent
e05dc827cc
commit
e8bf45a5d9
3 changed files with 66 additions and 3 deletions
62
test/isl-mock-channel-test-suite.cc
Normal file
62
test/isl-mock-channel-test-suite.cc
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#include "ns3/applications-module.h"
|
||||
#include "ns3/node-container.h"
|
||||
|
||||
#include "ns3/leo-module.h"
|
||||
#include "ns3/test.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
class IslMockChannelTransmitTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
IslMockChannelTransmitTestCase ();
|
||||
virtual ~IslMockChannelTransmitTestCase ();
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
};
|
||||
|
||||
IslMockChannelTransmitTestCase::IslMockChannelTransmitTestCase ()
|
||||
: TestCase ("Test channel transmission")
|
||||
{
|
||||
}
|
||||
|
||||
IslMockChannelTransmitTestCase::~IslMockChannelTransmitTestCase ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
IslMockChannelTransmitTestCase::DoRun (void)
|
||||
{
|
||||
Ptr<IslMockChannel> channel = CreateObject<IslMockChannel> ();
|
||||
Packet *packet = new Packet ();
|
||||
Ptr<Packet> p = Ptr<Packet>(packet);
|
||||
Ptr<MockNetDevice> dev = CreateObject<MockNetDevice> ();
|
||||
int32_t srcId = channel->Attach (dev);
|
||||
Address destAddr;
|
||||
Time txTime;
|
||||
bool result = channel->TransmitStart (p, srcId, destAddr, txTime);
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (result, false, "Unknown destination fails to deliver");
|
||||
}
|
||||
|
||||
class IslMockChannelTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
IslMockChannelTestSuite ();
|
||||
};
|
||||
|
||||
IslMockChannelTestSuite::IslMockChannelTestSuite ()
|
||||
: TestSuite ("isl-mock-channel", UNIT)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new IslMockChannelTransmitTestCase, TestCase::QUICK);
|
||||
}
|
||||
|
||||
// Do not forget to allocate an instance of this TestSuite
|
||||
static IslMockChannelTestSuite islMockChannelTestSuite;
|
Loading…
Add table
Add a link
Reference in a new issue