4 #include "ns3/double-probe.h"
6 #include "ns3/random-variable-stream.h"
7 #include "ns3/trace-source-accessor.h"
8 #include "ns3/traced-value.h"
9 #include "ns3/nstime.h"
10 #include "ns3/simulator.h"
11 #include "ns3/object.h"
12 #include "ns3/type-id.h"
13 #include "ns3/names.h"
29 static TypeId GetTypeId (
void);
32 m_var = CreateObject<ExponentialRandomVariable> ();
45 m_time = m_var->GetValue ();
63 aux = m_var->GetValue ();
79 .AddTraceSource (
"Emitter",
"XX",
81 "ns3::TracedValueCallback::Double")
99 virtual void DoRun (
void);
107 void TraceSink (std::string context,
double oldValue,
double newValue);
114 :
TestCase (
"basic probe test case"),
132 if (context ==
"testProbe")
136 else if (context ==
"testProbe2")
146 m_s = CreateObject<SampleEmitter> ();
151 p->SetName (
"testProbe");
156 Simulator::Stop (
Seconds (300));
160 Names::Add (
"/Names/SampleEmitter",
m_s);
163 p->ConnectByObject (
"Emitter",
m_s);
171 p2->SetName (
"testProbe2");
176 p2->ConnectByPath (
"/Names/SampleEmitter/Emitter");
186 Simulator::Destroy ();
DoubleProbe class - Test case for connecting and receiving data.
virtual ~ProbeTestCase1()
void TraceSink(std::string context, double oldValue, double newValue)
Trace sink.
uint32_t m_pathProbed
Number of probed by Path.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< SampleEmitter > m_s
Sample emitter pointer.
uint32_t m_objectProbed
Number of probes by Object.
DoubleProbe class TestSuite.
Simple data emitter to check that a probe receives data.
void Reschedule()
Reschedule a report.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< ExponentialRandomVariable > m_var
Random value generator.
void Report()
Reports a new value and reschedules.
double m_time
Delta time between reschedules.
void Start()
Start emission of data.
TracedValue< double > m_trace
Trace.
A base class which provides memory management and object aggregation.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now(void)
Return the current simulation virtual time.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static ProbeTestSuite probeTestSuite
Static variable for test initialization.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...