Tools to define and execute unit tests. More...
Modules | |
Testing Implementation | |
Internal implementation of the Testing system. | |
Files | |
file | sample-test-suite.cc |
Example use of TestSuite. | |
file | test.cc |
ns3::TestCase, ns3::TestSuite, ns3::TestRunner implementations, | |
file | test.h |
ns3::TestCase, ns3::TestSuite, ns3::TestRunner declarations, and NS_TEST_ASSERT macro definitions. | |
Classes | |
class | ns3::TestCase |
encapsulates test code More... | |
class | ns3::TestSuite |
A suite of tests to run. More... | |
class | ns3::TestVectors< T > |
A simple way to store test vectors (for stimulus or from responses) More... | |
Macros | |
#define | ASSERT_ON_FAILURE |
Check if we should assert on errors, and do so. More... | |
#define | CONTINUE_ON_FAILURE |
If we shouldn't continue on errors, return. More... | |
#define | CONTINUE_ON_FAILURE_RETURNS_BOOL |
If we shouldn't continue on errors, return test status. More... | |
#define | NS_TEST_ASSERT_MSG_EQ(actual, limit, msg) NS_TEST_ASSERT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are equal and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL(actual, limit, msg) NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are equal and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg) NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL(actual, limit, tol, msg) NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_GT(actual, limit, msg) NS_TEST_ASSERT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than a limit and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg) NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than or equal to a limit and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_LT(actual, limit, msg) NS_TEST_ASSERT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than a limit and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg) NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than or equal to a limit and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_NE(actual, limit, msg) NS_TEST_ASSERT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are not equal and report and abort if not. More... | |
#define | NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL(actual, limit, msg) NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are not equal and report and abort if not. More... | |
#define | NS_TEST_EXPECT_MSG_EQ(actual, limit, msg) NS_TEST_EXPECT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are equal and report if not. More... | |
#define | NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg) NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if not. More... | |
#define | NS_TEST_EXPECT_MSG_GT(actual, limit, msg) NS_TEST_EXPECT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than a limit and report if not. More... | |
#define | NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg) NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than or equal to limit and report if not. More... | |
#define | NS_TEST_EXPECT_MSG_LT(actual, limit, msg) NS_TEST_EXPECT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than a limit and report if not. More... | |
#define | NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg) NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than or equal to a limit and report if not. More... | |
#define | NS_TEST_EXPECT_MSG_NE(actual, limit, msg) NS_TEST_EXPECT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are not equal and report if not. More... | |
Functions | |
bool | ns3::TestDoubleIsEqual (const double a, const double b, const double epsilon=std::numeric_limits< double >::epsilon()) |
Compare two double precision floating point numbers and declare them equal if they are within some epsilon of each other. More... | |
Tools to define and execute unit tests.
This module lists the normal Testing API. Most of these macros forward to the implementation macros in testingimpl. You should generally use these macros only.
#define ASSERT_ON_FAILURE |
#define CONTINUE_ON_FAILURE |
#define CONTINUE_ON_FAILURE_RETURNS_BOOL |
#define NS_TEST_ASSERT_MSG_EQ | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are equal and report and abort if not.
Check to see if the expected (limit) value is equal to the actual value found in a test case. If the two values are equal nothing happens, but if the comparison fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 168 of file test.h.
Referenced by TcpRtoTest::AfterRTOExpired(), TcpSsThreshRtoTest::AfterRTOExpired(), TcpTimeRtoTest::AfterRTOExpired(), RrcHeaderTestCase::AssertEqualRadioResourceConfigDedicated(), TcpBytesInFlightTest::BytesInFlightTrace(), ns3::int64x64::test::Int64x64Bug455TestCase::Check(), ns3::int64x64::test::Int64x64Bug863TestCase::Check(), ns3::int64x64::test::Int64x64CompareTestCase::Check(), LteX2HandoverTestCase::CheckConnected(), LteRrcConnectionEstablishmentTestCase::CheckConnected(), LteX2HandoverMeasuresTestCase::CheckConnected(), TcpHeaderWithRFC793OptionTestCase::CheckCorrectDeserialize(), LteIpv6RoutingTestCase::Checker(), AnimationInterfaceTestCase::CheckLogic(), AnimationRemainingEnergyTestCase::CheckLogic(), TcpHeaderWithRFC793OptionTestCase::CheckNoPadding(), LteRrcConnectionEstablishmentTestCase::CheckNotConnected(), LteCellSelectionTestCase::CheckPoint(), TracedValueCallbackTestCase::CheckType(), ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), TcpFastRetrTest::CongStateTrace(), PeerManagementProtocolRegressionTest::CreateDevices(), Bug772ChainTest::CreateDevices(), HwmpProactiveRegressionTest::CreateDevices(), FlameRegressionTest::CreateDevices(), HwmpDoRfRegressionTest::CreateDevices(), HwmpSimplestRegressionTest::CreateDevices(), ChainRegressionTest::CreateDevices(), ns3::olsr::HelloRegressionTest::CreateNodes(), TcpSlowStartNormalTest::CWndTrace(), ns3::TcpEcnTest::CWndTrace(), LteLinkAdaptationTestCase::DlScheduling(), LteCqiGenerationTestCase::DlScheduling(), LteInterferenceTestCase::DlScheduling(), LtePathlossModelSystemTestCase::DlScheduling(), LteCqiGenerationDlPowerControlTestCase::DlScheduling(), LteRlcUmTransmitterTestCase::DoCheckDataReceived(), LteRlcAmTransmitterTestCase::DoCheckDataReceived(), BasicTracedCallbackTestCase::DoRun(), Ipv6AddressTestCase::DoRun(), OlsrEmfTestCase::DoRun(), WaveformGeneratorTestCase::DoRun(), TimeSimpleTestCase::DoRun(), BriteTopologyStructureTestCase::DoRun(), WifiInterferenceTestCase::DoRun(), FlameHeaderTest::DoRun(), PfifoFastQueueDiscTosPrioritization::DoRun(), IpAddressHelperTestCasev6::DoRun(), ns3::tests::WatchdogTestCase::DoRun(), DsaRequestTestCase::DoRun(), LrWpanPacketTestCase::DoRun(), Ipv4L3ProtocolTestCase::DoRun(), Ns3WimaxCsParamTlvTestCase::DoRun(), Ipv6L3ProtocolTestCase::DoRun(), SwitchFlowTableTestCase::DoRun(), ns3::tests::TypeTraitsTestCase::DoRun(), WifiAcMappingTest::DoRun(), TcpHighSpeedIncrementTest::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), MeshHeaderTest::DoRun(), UniqueTypeIdTestCase::DoRun(), BasicCallbackTestCase::DoRun(), BufferTest::DoRun(), TcpHyblaIncrementTest::DoRun(), ns3::tests::BuildProfileTestCase::DoRun(), Ns3TcpNoDelayTestCase::DoRun(), MeshInformationElementVectorBist::DoRun(), TimerStateTestCase::DoRun(), Ns3TcpSocketTestCase1::DoRun(), ns3::tests::GlobalValueTestCase::DoRun(), ClassicRecoveryTest::DoRun(), NscTcpLossTestCase1::DoRun(), UdpClientServerTestCase::DoRun(), TcpScalableIncrementTest::DoRun(), DhcpTestCase::DoRun(), EpsGtpuHeaderTestCase::DoRun(), TcpHeaderGetSetTestCase::DoRun(), CsmaBridgeTestCase::DoRun(), LrWpanErrorDistanceTestCase::DoRun(), LteAggregationThroughputScaleTestCase::DoRun(), TcpHtcpIncrementTest::DoRun(), TcpVegasTest::DoRun(), LteRlcUmE2eTestCase::DoRun(), TcpVenoTest::DoRun(), LteRlcAmE2eTestCase::DoRun(), TcpYeahIncrementTest::DoRun(), DsdvHeaderTestCase::DoRun(), OlsrMidTestCase::DoRun(), TcpIllinoisTest::DoRun(), RandomRoomPositionAllocatorTestCase::DoRun(), LteSecondaryCellSelectionTestCase::DoRun(), Ipv4ListRoutingNegativeTestCase::DoRun(), SpectrumIdealPhyTestCase::DoRun(), ns3::aodv::LoopbackTestCase::DoRun(), ErrorModelSimple::DoRun(), CarrierAggregationTestCase::DoRun(), Ipv6ListRoutingNegativeTestCase::DoRun(), LteDownlinkPowerControlSpectrumValueTestCase::DoRun(), OcbWifiMacTestCase::DoRun(), SpectrumWifiPhyBasicTest::DoRun(), FqCoDelQueueDiscNoSuitableFilter::DoRun(), ns3::tests::SampleTestCase1::DoRun(), WriteModeCreateTestCase::DoRun(), BuildingsHelperOneTestCase::DoRun(), CarrierAggregationConfigTestCase::DoRun(), EpcTftClassifierTestCase::DoRun(), TcpHighSpeedDecrementTest::DoRun(), ns3::tests::BasicAddTestCase::DoRun(), Ipv4ListRoutingPositiveTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), LteNoisePsdTestCase::DoRun(), ThreeGppHttpObjectTestCase::DoRun(), Ipv6ListRoutingPositiveTestCase::DoRun(), PfifoFastQueueDiscDscpPrioritization::DoRun(), LteEpcE2eDataTestCase::DoRun(), DsdvTableTestCase::DoRun(), TcpScalableDecrementTest::DoRun(), CollisionTestCase::DoRun(), LinkTest::DoRun(), ns3::tests::CommandLineBooleanTestCase::DoRun(), LteHardFrTestCase::DoRun(), ns3::RlcAmStatusPduTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), RandomVariableStreamUniformTestCase::DoRun(), FqCoDelQueueDiscIPFlowsSeparationAndPacketLimit::DoRun(), Ns3WimaxSfTlvTestCase::DoRun(), SameRoomPositionAllocatorTestCase::DoRun(), Ns3TcpSocketTestCase2::DoRun(), LteTxPsdTestCase::DoRun(), NscTcpLossTestCase2::DoRun(), CsmaBroadcastTestCase::DoRun(), LteDownlinkPowerControlRrcConnectionReconfigurationTestCase::DoRun(), ns3::tests::CreateObjectTestCase::DoRun(), ns3::tests::StringContextAddTestCase::DoRun(), BurstErrorModelSimple::DoRun(), LteStrictFrTestCase::DoRun(), ns3::tests::CommandLineIntTestCase::DoRun(), OlsrHelloTestCase::DoRun(), MakeCallbackTestCase::DoRun(), PacketLossCounterTestCase::DoRun(), PfifoFastQueueDiscOverflow::DoRun(), Ns3TcpCwndTestCase1::DoRun(), FqCoDelQueueDiscDeficit::DoRun(), IpAddressHelperTestCasev4::DoRun(), ReadModeCreateTestCase::DoRun(), LanTest::DoRun(), ns3::tests::CommandLineUnsignedIntTestCase::DoRun(), AcousticModemEnergyDepletionTestCase::DoRun(), ns3::tests::AggregateObjectTestCase::DoRun(), ns3::tests::FullyQualifiedAddTestCase::DoRun(), Ns2MobilityHelperTest::DoRun(), OlsrTcTestCase::DoRun(), TcpYeahDecrementTest::DoRun(), ns3::tests::CommandLineStringTestCase::DoRun(), SpectrumWifiPhyListenerTest::DoRun(), DeprecatedAttributeTestCase::DoRun(), PfifoFastQueueDiscNoPriority::DoRun(), RandomVariableStreamUniformAntitheticTestCase::DoRun(), CsmaMulticastTestCase::DoRun(), ns3::tests::CommandLineOrderTestCase::DoRun(), ns3::tests::RootNamespaceConfigTestCase::DoRun(), OlsrHnaTestCase::DoRun(), TwoLinkTest::DoRun(), LteStrictFrAreaTestCase::DoRun(), RrcConnectionRequestTestCase::DoRun(), ns3::tests::RelativeAddTestCase::DoRun(), MakeBoundCallbackTestCase::DoRun(), ns3::tests::CommandLineInvalidTestCase::DoRun(), CoDelQueueDiscNewtonStepTest::DoRun(), LteSoftFrAreaTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LteSoftFfrAreaTestCase::DoRun(), ns3::tests::UnderRootNamespaceConfigTestCase::DoRun(), FqCoDelQueueDiscTCPFlowsSeparation::DoRun(), ns3::tests::CommandLineNonOptionTestCase::DoRun(), RrcConnectionSetupTestCase::DoRun(), MatrixPropagationLossModelTestCase::DoRun(), AttributeTestCase< T >::DoRun(), TcpHeaderFlagsToString::DoRun(), LteEnhancedFfrAreaTestCase::DoRun(), ns3::tests::BasicRenameTestCase::DoRun(), LteDistributedFfrAreaTestCase::DoRun(), Ns3TcpCwndTestCase2::DoRun(), RrcConnectionSetupCompleteTestCase::DoRun(), TwoLanTest::DoRun(), ns3::tests::ObjectFactoryTestCase::DoRun(), DcfImmediateAccessBroadcastTestCase::DoRun(), FileHeaderTestCase::DoRun(), FqCoDelQueueDiscUDPFlowsSeparation::DoRun(), CsmaOneSubnetTestCase::DoRun(), ns3::tests::StringContextRenameTestCase::DoRun(), RrcConnectionReconfigurationCompleteTestCase::DoRun(), ns3::tests::ObjectVectorConfigTestCase::DoRun(), ns3::tests::FullyQualifiedRenameTestCase::DoRun(), RrcConnectionReconfigurationTestCase::DoRun(), BridgeTest::DoRun(), NullifyCallbackTestCase::DoRun(), Bug730TestCase::DoRun(), CsmaPacketSocketTestCase::DoRun(), ns3::tests::RelativeRenameTestCase::DoRun(), ns3::tests::FindPathTestCase::DoRun(), ns3::tests::ObjectVectorTraceConfigTestCase::DoRun(), RecordHeaderTestCase::DoRun(), CsmaPingTestCase::DoRun(), TwoBridgeTest::DoRun(), ns3::tests::BasicFindTestCase::DoRun(), SetChannelFrequencyTest::DoRun(), HandoverPreparationInfoTestCase::DoRun(), ns3::tests::StringContextFindTestCase::DoRun(), ns3::tests::SearchAttributesOfParentObjectsTestCase::DoRun(), CsmaRawIpSocketTestCase::DoRun(), RandomVariableStreamAttributeTestCase::DoRun(), RrcConnectionReestablishmentRequestTestCase::DoRun(), ns3::tests::FullyQualifiedFindTestCase::DoRun(), ObjectVectorAttributeTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), RrcConnectionReestablishmentTestCase::DoRun(), ns3::tests::RelativeFindTestCase::DoRun(), CsmaStarTestCase::DoRun(), RrcConnectionReestablishmentCompleteTestCase::DoRun(), ObjectMapAttributeTestCase::DoRun(), ns3::tests::AlternateFindTestCase::DoRun(), RrcConnectionRejectTestCase::DoRun(), IntegerTraceSourceAttributeTestCase::DoRun(), ReadFileTestCase::DoRun(), MeasurementReportTestCase::DoRun(), Bug2222TestCase::DoRun(), IntegerTraceSourceTestCase::DoRun(), DiffTestCase::DoRun(), TracedCallbackTestCase::DoRun(), Bug2483TestCase::DoRun(), PointerAttributeTestCase::DoRun(), CallbackValueTestCase::DoRun(), Bug2831TestCase::DoRun(), StaWifiMacScanningTestCase::DoRun(), LteHandoverTargetTestCase::DoTeardown(), LteUeMeasurementsPiecewiseTestCase1::DoTeardown(), LteUeMeasurementsPiecewiseTestCase2::DoTeardown(), LteUeMeasurementsHandoverTestCase::DoTeardown(), CarrierAggregationConfigTestCase::Evaluate(), ns3::TcpLpToNewReno::ExecuteTest(), TcpLedbatToNewReno::ExecuteTest(), TcpBicIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest1::ExecuteTest(), TcpLedbatIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest2::ExecuteTest(), TcpBicDecrementTest::ExecuteTest(), TcpLedbatDecrementTest::ExecuteTest(), ns3::TcpCloseWithLossTestCase::FinalChecks(), TcpZeroWindowTest::FinalChecks(), TcpRttEstimationTest::FinalChecks(), TcpRtoTest::FinalChecks(), TcpPktsAckedOpenTest::FinalChecks(), TcpFastRetrTest::FinalChecks(), TcpBytesInFlightTest::FinalChecks(), TcpDataSentCbTestCase::FinalChecks(), TcpTimeRtoTest::FinalChecks(), LteHandoverTargetTestCase::HandoverStartCallback(), TcpAdvertisedWindowTest::InvalidAwndCb(), TcpAdvWindowOnLossTest::InvalidAwndCb(), TcpHeaderWithRFC793OptionTestCase::OneOptionAtTime(), TcpFastRetrTest::PktDropped(), TcpZeroWindowTest::ProcessedAck(), TcpFastRetrTest::ProcessedAck(), TcpRtoTest::ProcessedAck(), TcpFastRetrTest::RcvAck(), TcpRtoTest::RcvAck(), LteUeMeasurementsTestCase::RecvMeasurementReport(), LteUeMeasurementsPiecewiseTestCase1::RecvMeasurementReportCallback(), LteUeMeasurementsPiecewiseTestCase2::RecvMeasurementReportCallback(), LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallback(), SpectrumInterferenceTestCase::RetrieveTestResult(), TcpZeroWindowTest::Rx(), ns3::TcpEcnTest::Rx(), Ipv4PacketInfoTagTest::RxCb(), Ipv6PacketInfoTagTest::RxCb(), ThreeGppHttpObjectTestCase::ServerRxCallback(), PowerRateAdaptationTest::TestAparf(), PbbTestCase::TestDeserialize(), PfifoFastQueueDiscDscpPrioritization::TestDscpValue(), TcpTxBufferTestCase::TestIsLost(), TcpTxBufferTestCase::TestNewBlock(), TcpTxBufferTestCase::TestNextSeg(), PowerRateAdaptationTest::TestParf(), PowerRateAdaptationTest::TestRrpaa(), PbbTestCase::TestSerialize(), PfifoFastQueueDiscTosPrioritization::TestTosValue(), TcpRxBufferTestCase::TestUpdateSACKList(), TcpZeroWindowTest::Tx(), SackPermittedTestCase::Tx(), TimestampTestCase::Tx(), TcpFastRetrTest::Tx(), ns3::TcpEcnTest::Tx(), WScalingTestCase::Tx(), TcpTimeRtoTest::Tx(), LteCqiGenerationTestCase::UlScheduling(), LteInterferenceTestCase::UlScheduling(), LteCqiGenerationDlPowerControlTestCase::UlScheduling(), TcpRttEstimationTest::UpdatedRttHistory(), and Ns3TcpCwndTestCase2::VerifyCwndRun().
#define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are equal and report and abort if not.
Check to see if the expected (limit) value is equal to the actual value found in a test case. If the two values are equal nothing happens, but if the comparison fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | msg | Message that is output if the test does not pass. |
This function returns a Boolean value.
Definition at line 227 of file test.h.
Referenced by UanTest::DoPhyTests(), and Ns2MobilityHelperTest::WriteTrace().
#define NS_TEST_ASSERT_MSG_EQ_TOL | ( | actual, | |
limit, | |||
tol, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not.
Check to see if the expected (limit) value is equal to the actual value found in a test case to some tolerance. This is not the same thing as asking if two floating point are equal to within some epsilon, but is useful for that case. This assertion is geared toward more of a measurement problem. Consider measuring a physical rod of some kind that you have ordered. You need to determine if it is "good." You want to measure the rod to an arbitrary precision of sixteen significant figures, you will measure the rod to determine if its length is within the tolerances you provided. For example, 12.00 inches plus or minus .005 inch may be just fine.
In ns-3, you might want to measure a signal to noise ratio and check to see if the answer is what you expect. If you naively measure (double)1128.93 and compare this number with a constant 1128.93 you are almost certainly going to have your test fail because of floating point rounding errors. We provide a floating point comparison function ns3::TestDoubleIsEqual() but you will probably quickly find that is not what you want either. It may turn out to be the case that when you measured an SNR that printed as 1128.93, what was actually measured was something more like 1128.9287653857625442 for example. Given that the double epsilon is on the order of 0.0000000000000009, you would need to provide sixteen significant figures of expected value for this kind of test to pass even with a typical test for floating point "approximate equality." That is clearly not required or desired. You really want to be able to provide 1128.93 along with a tolerance just like you provided 12 inches +- 0.005 inch above.
This assertion is designed for real measurements by taking into account measurement tolerances. By doing so it also automatically compensates for floating point rounding errors. If you really want to check floating point equality down to the numeric_limits<double>::epsilon () range, consider using ns3::TestDoubleIsEqual().
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | tol | Tolerance of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 380 of file test.h.
Referenced by TcpTimeRtoTest::AfterRTOExpired(), TimestampValueTestCase::Check(), ns3::int64x64::test::Int64x64DoubleTestCase::Check(), ns3::int64x64::test::Int64x64InvertTestCase::CheckCase(), AnimationRemainingEnergyTestCase::CheckLogic(), LteFrAreaTestCase::DlDataRxStart(), LiIonEnergyTestCase::DoRun(), TimeSimpleTestCase::DoRun(), OneIntegerTestCase::DoRun(), RttEstimatorTestCase::DoRun(), LrWpanSpectrumValueHelperTestCase::DoRun(), BasicEnergyHarvesterTestCase::DoRun(), ItuR1411LosPropagationLossModelTestCase::DoRun(), ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun(), Kun2600MhzPropagationLossModelTestCase::DoRun(), OkumuraHataPropagationLossModelTestCase::DoRun(), OneIntegerAverageTestCase::DoRun(), BuildingsShadowingTestCase::DoRun(), BuildingsPathlossTestCase::DoRun(), UanTest::DoRun(), ns3::LenaDeactivateBearerTestCase::DoRun(), TcpHyblaIncrementTest::DoRun(), TvSpectrumTransmitterTestCase::DoRun(), WifiErrorRateModelsTestCaseDsss::DoRun(), LenaMimoTestCase::DoRun(), LenaHarqTestCase::DoRun(), LteEarfcnTestCase::DoRun(), LenaRrFfMacSchedulerTestCase::DoRun(), LenaDataPhyErrorModelTestCase::DoRun(), LteAggregationThroughputScaleTestCase::DoRun(), LenaPfFfMacSchedulerTestCase1::DoRun(), LenaTdBetFfMacSchedulerTestCase1::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaCqaFfMacSchedulerTestCase1::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaFdBetFfMacSchedulerTestCase1::DoRun(), LenaPssFfMacSchedulerTestCase1::DoRun(), LenaTdTbfqFfMacSchedulerTestCase1::DoRun(), LteInterferenceHardFrTestCase::DoRun(), LenaFdTbfqFfMacSchedulerTestCase1::DoRun(), LteLinkAdaptationTestCase::DoRun(), AcousticModemEnergyTestCase::DoRun(), SpectrumIdealPhyTestCase::DoRun(), LtePathlossModelSystemTestCase::DoRun(), LteEnbAntennaTestCase::DoRun(), LrWpanErrorModelTestCase::DoRun(), LteInterferenceTestCase::DoRun(), ns3::tests::SampleTestCase1::DoRun(), LteEarfcnDlTestCase::DoRun(), LteInterferenceStrictFrTestCase::DoRun(), LenaPfFfMacSchedulerTestCase2::DoRun(), LenaTdBetFfMacSchedulerTestCase2::DoRun(), LenaDlCtrlPhyErrorModelTestCase::DoRun(), LenaFdBetFfMacSchedulerTestCase2::DoRun(), LenaTdTbfqFfMacSchedulerTestCase2::DoRun(), TimeWithSignTestCase::DoRun(), LenaPssFfMacSchedulerTestCase2::DoRun(), LenaCqaFfMacSchedulerTestCase2::DoRun(), FiveIntegersAverageTestCase::DoRun(), LteDownlinkPowerControlTestCase::DoRun(), FiveIntegersTestCase::DoRun(), LenaFdTbfqFfMacSchedulerTestCase2::DoRun(), LteEarfcnUlTestCase::DoRun(), WifiErrorRateModelsTestCaseNist::DoRun(), FiveDoublesAverageTestCase::DoRun(), FiveDoublesTestCase::DoRun(), RandomVariableStreamConstantTestCase::DoRun(), RandomVariableStreamSequentialTestCase::DoRun(), RandomVariableStreamNormalTestCase::DoRun(), GeoToCartesianTestCase::DoRun(), RandomVariableStreamNormalAntitheticTestCase::DoRun(), RandomVariableStreamExponentialTestCase::DoRun(), RandomVariableStreamExponentialAntitheticTestCase::DoRun(), RandomVariableStreamParetoTestCase::DoRun(), RandomVariableStreamParetoAntitheticTestCase::DoRun(), RandomVariableStreamWeibullTestCase::DoRun(), RandomVariableStreamWeibullAntitheticTestCase::DoRun(), RandomVariableStreamLogNormalTestCase::DoRun(), RandomVariableStreamLogNormalAntitheticTestCase::DoRun(), RandomVariableStreamGammaTestCase::DoRun(), RandomVariableStreamGammaAntitheticTestCase::DoRun(), RandomVariableStreamErlangTestCase::DoRun(), RandomVariableStreamErlangAntitheticTestCase::DoRun(), RandomVariableStreamZipfTestCase::DoRun(), RandomVariableStreamZipfAntitheticTestCase::DoRun(), RandomVariableStreamZetaTestCase::DoRun(), RandomVariableStreamZetaAntitheticTestCase::DoRun(), RandomVariableStreamDeterministicTestCase::DoRun(), RandomVariableStreamEmpiricalTestCase::DoRun(), RandomVariableStreamEmpiricalAntitheticTestCase::DoRun(), LteUplinkPowerControlTestCase::PucchTxPowerTrace(), LteUplinkPowerControlTestCase::PuschTxPowerTrace(), LteUeMeasurementsTestCase::ReportUeMeasurements(), LteUplinkPowerControlTestCase::SrsTxPowerTrace(), ProbeTestCase1::TraceSink(), TcpTimeRtoTest::Tx(), and LteFrAreaTestCase::UlDataRxStart().
#define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL | ( | actual, | |
limit, | |||
tol, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and abort if not.
Check to see if the expected (limit) value is equal to the actual value found in a test case to some tolerance. This is not the same thing as asking if two floating point are equal to within some epsilon, but is useful for that case. This assertion is geared toward more of a measurement problem. Consider measuring a physical rod of some kind that you have ordered. You need to determine if it is "good." You want to measure the rod to an arbitrary precision of sixteen significant figures, you will measure the rod to determine if its length is within the tolerances you provided. For example, 12.00 inches plus or minus .005 inch may be just fine.
In ns-3, you might want to measure a signal to noise ratio and check to see if the answer is what you expect. If you naively measure (double)1128.93 and compare this number with a constant 1128.93 you are almost certainly going to have your test fail because of floating point rounding errors. We provide a floating point comparison function ns3::TestDoubleIsEqual() but you will probably quickly find that is not what you want either. It may turn out to be the case that when you measured an SNR that printed as 1128.93, what was actually measured was something more like 1128.9287653857625442 for example. Given that the double epsilon is on the order of 0.0000000000000009, you would need to provide sixteen significant figures of expected value for this kind of test to pass even with a typical test for floating point "approximate equality." That is clearly not required or desired. You really want to be able to provide 1128.93 along with a tolerance just like you provided 12 inches +- 0.005 inch above.
This assertion is designed for real measurements by taking into account measurement tolerances. By doing so it also automatically compensates for floating point rounding errors. If you really want to check floating point equality down to the numeric_limits<double>::epsilon () range, consider using ns3::TestDoubleIsEqual().
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | tol | Tolerance of the test. |
[in] | msg | Message that is output if the test does not pass. |
This function returns a Boolean value.
#define NS_TEST_ASSERT_MSG_GT | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than a limit and report and abort if not.
Check to see if the actual value found in a test case is greater than the limit value. If the actual value is greater nothing happens, but if the check fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 997 of file test.h.
Referenced by LteX2HandoverMeasuresTestCase::CheckStats(), LteX2HandoverTestCase::CheckStatsAWhileAfterHandover(), ThreeGppHttpObjectTestCase::ClientRxEmbeddedObjectCallback(), ThreeGppHttpObjectTestCase::ClientRxMainObjectCallback(), WifiMsduAggregatorThroughputTest::DoRun(), BuildingsShadowingTestCase::DoRun(), ns3::tests::OneUniformRandomVariableManyGetValueCallsTestCase::DoRun(), ns3::tests::ManyUniformRandomVariablesOneGetValueCallTestCase::DoRun(), TvHelperDistributionTestCase::DoRun(), RandomRoomPositionAllocatorTestCase::DoRun(), ProbeTestCase1::DoRun(), OcbWifiMacTestCase::DoRun(), ns3::RlcAmStatusPduTestCase::DoRun(), RandomVariableStreamUniformTestCase::DoRun(), LteHandoverTargetTestCase::HandoverStartCallback(), ThreeGppHttpObjectTestCase::ServerRxCallback(), and ProbeTestCase1::TraceSink().
#define NS_TEST_ASSERT_MSG_GT_OR_EQ | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than or equal to a limit and report and abort if not.
Check to see if the actual value found in a test case is greater than or equal to the limit value. If the actual value is greater nothing happens, but if the check fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 1018 of file test.h.
Referenced by TcpSlowStartNormalTest::CWndTrace(), WifiAcMappingTest::DoRun(), PrrRecoveryTest::DoRun(), and TcpFastRetrTest::ProcessedAck().
#define NS_TEST_ASSERT_MSG_LT | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than a limit and report and abort if not.
Check to see if the actual value found in a test case is less than the limit value. If the actual value is lesser nothing happens, but if the check fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 811 of file test.h.
Referenced by BuildingsShadowingTestCase::DoRun(), ns3::tests::OneUniformRandomVariableManyGetValueCallsTestCase::DoRun(), ns3::tests::ManyUniformRandomVariablesOneGetValueCallTestCase::DoRun(), TvHelperDistributionTestCase::DoRun(), RngUniformTestCase::DoRun(), RandomRoomPositionAllocatorTestCase::DoRun(), OcbWifiMacTestCase::DoRun(), RandCartAroundGeoTestCase::DoRun(), ns3::RlcAmStatusPduTestCase::DoRun(), RandomVariableStreamUniformTestCase::DoRun(), RngNormalTestCase::DoRun(), RngExponentialTestCase::DoRun(), RandomVariableStreamUniformAntitheticTestCase::DoRun(), RngParetoTestCase::DoRun(), RandomVariableStreamNormalTestCase::DoRun(), RandomVariableStreamNormalAntitheticTestCase::DoRun(), RandomVariableStreamExponentialTestCase::DoRun(), RandomVariableStreamExponentialAntitheticTestCase::DoRun(), RandomVariableStreamParetoTestCase::DoRun(), RandomVariableStreamParetoAntitheticTestCase::DoRun(), RandomVariableStreamWeibullTestCase::DoRun(), RandomVariableStreamWeibullAntitheticTestCase::DoRun(), RandomVariableStreamLogNormalTestCase::DoRun(), RandomVariableStreamLogNormalAntitheticTestCase::DoRun(), RandomVariableStreamGammaTestCase::DoRun(), RandomVariableStreamGammaAntitheticTestCase::DoRun(), RandomVariableStreamErlangTestCase::DoRun(), RandomVariableStreamErlangAntitheticTestCase::DoRun(), RandomVariableStreamEmpiricalTestCase::DoRun(), LteHandoverDelayTestCase::EnbHandoverEndOkCallback(), ProbeTestCase1::TraceSink(), and LteHandoverDelayTestCase::UeHandoverEndOkCallback().
#define NS_TEST_ASSERT_MSG_LT_OR_EQ | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than or equal to a limit and report and abort if not.
Check to see if the actual value found in a test case is less than or equal to the limit value. If the actual value is lesser or equal nothing happens, but if the check fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 832 of file test.h.
Referenced by TcpNewRenoCongAvoidNormalTest::Check(), TcpSlowStartNormalTest::CWndTrace(), TcpHyblaIncrementTest::DoRun(), and PrrRecoveryTest::DoRun().
#define NS_TEST_ASSERT_MSG_NE | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are not equal and report and abort if not.
Check to see if the expected (limit) value is not equal to the actual value found in a test case. If the two values are not equal nothing happens, but if the comparison fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the value that actual is tested against. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 624 of file test.h.
Referenced by LteX2HandoverTestCase::CheckConnected(), LteX2HandoverMeasuresTestCase::CheckConnected(), AbstractAnimationInterfaceTestCase::CheckFileExistence(), SwitchFlowTableTestCase::DoRun(), RocketfuelTopologyReaderTest::DoRun(), BufferTest::DoRun(), TcpHyblaIncrementTest::DoRun(), ThreeGppHttpObjectTestCase::DoRun(), CollisionTestCase::DoRun(), LinkTest::DoRun(), ns3::tests::CreateObjectTestCase::DoRun(), LanTest::DoRun(), ns3::tests::AggregateObjectTestCase::DoRun(), DeprecatedAttributeTestCase::DoRun(), TwoLinkTest::DoRun(), AttributeTestCase< T >::DoRun(), RandomVariableStreamConstantTestCase::DoRun(), TwoLanTest::DoRun(), ns3::tests::ObjectFactoryTestCase::DoRun(), FileHeaderTestCase::DoRun(), BridgeTest::DoRun(), RecordHeaderTestCase::DoRun(), TwoBridgeTest::DoRun(), RandomVariableStreamAttributeTestCase::DoRun(), ObjectVectorAttributeTestCase::DoRun(), ObjectMapAttributeTestCase::DoRun(), IntegerTraceSourceAttributeTestCase::DoRun(), IntegerTraceSourceTestCase::DoRun(), TracedCallbackTestCase::DoRun(), PointerAttributeTestCase::DoRun(), CallbackValueTestCase::DoRun(), ns3::TcpEcnTest::Rx(), TcpRttEstimationTest::Tx(), and ns3::TcpEcnTest::Tx().
#define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are not equal and report and abort if not.
Check to see if the expected (limit) value is not equal to the actual value found in a test case. If the two values are equal nothing happens, but if the comparison fails, an error is reported in a consistent way and the execution of the current test case is aborted.
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | msg | Message that is output if the test does not pass. |
This function returns a Boolean value.
Definition at line 682 of file test.h.
Referenced by Ns2MobilityHelperTest::CheckInitialPositions().
#define NS_TEST_EXPECT_MSG_EQ | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are equal and report if not.
Check to see if the expected (lmit) value is equal to the actual value found in a test case. If the two values are equal nothing happens, but if the comparison fails, an error is reported in a consistent way. EXPECT* macros do not return if an error is detected.
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 285 of file test.h.
Referenced by ns3::tests::HashTestCase::Check(), ns3::int64x64::test::Int64x64HiLoTestCase::Check(), ns3::int64x64::test::Int64x64InputTestCase::Check(), ns3::int64x64::test::Int64x64Bug1786TestCase::Check(), TcFlowControlTestCase::CheckDeviceQueueStopped(), QueueDiscTracesTestCase::CheckDroppedAfterDequeue(), QueueDiscTracesTestCase::CheckDroppedBeforeEnqueue(), Ns2MobilityHelperTest::CheckInitialPositions(), TcFlowControlTestCase::CheckPacketsInDeviceQueue(), TcFlowControlTestCase::CheckPacketsInQueueDisc(), QueueDiscTracesTestCase::CheckQueued(), PacketTagListTest::CheckRef(), Bug772ChainTest::CheckResults(), ns3::aodv::AodvRqueueTest::CheckSizeLimit(), DsrSendBuffTest::CheckSizeLimit(), ns3::aodv::AodvRqueueTest::CheckTimeout(), DsrSendBuffTest::CheckTimeout(), ns3::aodv::NeighborTest::CheckTimeout1(), ns3::aodv::IdCacheTest::CheckTimeout1(), ns3::aodv::NeighborTest::CheckTimeout2(), ns3::aodv::IdCacheTest::CheckTimeout2(), ns3::aodv::NeighborTest::CheckTimeout3(), ns3::aodv::IdCacheTest::CheckTimeout3(), RttEstimatorTestCase::CheckValues(), Ns2MobilityHelperTest::CourseChange(), WaypointMobilityModelNotifyTest::CourseChangeCallback(), WaypointMobilityModelAddWaypointTest::CourseChangeCallback(), HwmpReactiveRegressionTest::CreateDevices(), ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), CoDelQueueDiscBasicDrop::Dequeue(), TbfQueueDiscTestCase::DequeueAndCheck(), PacketTest::DoCheck(), SimulatorEventsTestCase::DoRun(), DropTailQueueTestCase::DoRun(), NetworkNumberAllocatorTestCase::DoRun(), NetworkNumber6AllocatorTestCase::DoRun(), NetworkAllocatorHelperTestCase::DoRun(), HistogramTestCase::DoRun(), ns3::aodv::NeighborTest::DoRun(), RttEstimatorTestCase::DoRun(), TxDurationTest::DoRun(), ns3::olsr::Bug780Test::DoRun(), Ns3WimaxNetworkEntryTestCase::DoRun(), Ns3WimaxFragmentationTestCase::DoRun(), PacketSocketAppsTest::DoRun(), TestEmptyOptionField::DoRun(), AmpduAggregationTest::DoRun(), RocketfuelTopologyReaderTest::DoRun(), BufferTest::DoRun(), LrWpanEdTestCase::DoRun(), ns3::aodv::IdCacheTest::DoRun(), LrWpanCollisionTestCase::DoRun(), ns3::tests::EventGarbageCollectorTestCase::DoRun(), OlsrMprTestCase::DoRun(), ThreadedSimulatorEventsTestCase::DoRun(), DualStackTestCase::DoRun(), SixlowpanFragmentationTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), PacketBufferingCaseA::DoRun(), Ipv6ForwardingTest::DoRun(), UdpSocketLoopbackTest::DoRun(), Ipv6RipngTest::DoRun(), Ipv4RipTest::DoRun(), Ipv4ForwardingTest::DoRun(), Ipv4StaticRoutingSlash32TestCase::DoRun(), SixlowpanIphcImplTest::DoRun(), DsrFsHeaderTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), ChannelCoordinationTestCase::DoRun(), TcpTestCase::DoRun(), Ipv4HeaderTest::DoRun(), AddressAllocator6TestCase::DoRun(), AddressAllocatorHelperTestCase::DoRun(), Ipv4RawSocketImplTest::DoRun(), AddressAllocatorTestCase::DoRun(), LrWpanCcaTestCase::DoRun(), ns3::tests::PtrTestCase::DoRun(), Ns3WimaxManagementConnectionsTestCase::DoRun(), TestOptionWithoutAlignment::DoRun(), DsrRreqHeaderTest::DoRun(), ThreeGppHttpObjectTestCase::DoRun(), Ipv4FragmentationTest::DoRun(), ns3::aodv::TypeHeaderTest::DoRun(), Udp6SocketLoopbackTest::DoRun(), DsdvTableTestCase::DoRun(), CoDelQueueDiscBasicEnqueueDequeue::DoRun(), Ipv6FragmentationTest::DoRun(), ResetAllocatorHelperTestCase::DoRun(), NetworkAndAddress6TestCase::DoRun(), NetworkAndAddressTestCase::DoRun(), ns3::aodv::RreqHeaderTest::DoRun(), PrioQueueDiscTestCase::DoRun(), DsrRrepHeaderTest::DoRun(), PacketBufferingCaseB::DoRun(), TestOptionWithAlignment::DoRun(), ExampleAddress6GeneratorTestCase::DoRun(), ns3::aodv::RrepHeaderTest::DoRun(), DsrSRHeaderTest::DoRun(), ExampleAddressGeneratorTestCase::DoRun(), UdpSocketImplTest::DoRun(), QosUtilsIsOldPacketTest::DoRun(), PeerLinkFrameStartTest::DoRun(), TestFulfilledAlignment::DoRun(), AddressCollision6TestCase::DoRun(), CoDelQueueDiscBasicOverflow::DoRun(), ns3::aodv::RrepAckHeaderTest::DoRun(), CtrlBAckResponseHeaderTest::DoRun(), DsrRerrHeaderTest::DoRun(), TwoLevelAggregationTest::DoRun(), AddressCollisionTestCase::DoRun(), ns3::aodv::RerrHeaderTest::DoRun(), Ipv4RipCountToInfinityTest::DoRun(), Ipv6RipngCountToInfinityTest::DoRun(), DsrAckReqHeaderTest::DoRun(), QueueDiscTracesTestCase::DoRun(), PacketMetadataTest::DoRun(), ns3::aodv::QueueEntryTest::DoRun(), DsrAckHeaderTest::DoRun(), CoDelQueueDiscControlLawTest::DoRun(), ns3::aodv::AodvRqueueTest::DoRun(), DsrCacheEntryTest::DoRun(), PacketTest::DoRun(), CoDelQueueDiscBasicDrop::DoRun(), DsrSendBuffTest::DoRun(), Udp6SocketImplTest::DoRun(), ns3::aodv::AodvRtableEntryTest::DoRun(), Ipv6RipngSplitHorizonStrategyTest::DoRun(), Ipv4RipSplitHorizonStrategyTest::DoRun(), DsrRreqTableTest::DoRun(), ChannelAccessTestCase::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), PacketTagListTest::DoRun(), DiffTestCase::DoRun(), Ipv4GlobalRoutingSlash32TestCase::DoRun(), FifoQueueDiscTestCase::DoRunFifoTest(), SixlowpanHc1ImplTest::DoSendData(), Ipv4StaticRoutingSlash32TestCase::DoSendData(), Ipv6ForwardingTest::DoSendData(), Ipv6RipngTest::DoSendData(), SixlowpanIphcImplTest::DoSendData(), Ipv4ForwardingTest::DoSendData(), Ipv4RipTest::DoSendData(), Ipv4RawSocketImplTest::DoSendData(), Ipv6RawSocketImplTest::DoSendData(), Ipv4PacketInfoTagTest::DoSendData(), Ipv6PacketInfoTagTest::DoSendData(), UdpSocketImplTest::DoSendData(), Ipv4RipCountToInfinityTest::DoSendData(), Ipv6RipngCountToInfinityTest::DoSendData(), Ipv4GlobalRoutingSlash32TestCase::DoSendData(), Ipv4RawSocketImplTest::DoSendData_IpHdr(), Ipv4HeaderTest::DoSendData_IpHdr_Dscp(), UdpSocketImplTest::DoSendDataTo(), Udp6SocketImplTest::DoSendDataTo(), ChannelAccessManagerTest::EndTest(), UdpSocketImplTest::GetPriority(), Ns3TcpStateTestCase::Ipv4L3Tx(), Ns3TcpLossTestCase::Ipv4L3Tx(), Ns3TcpInteroperabilityTestCase::Ipv4L3Tx(), ChannelAccessManagerTest::NotifyAccessGranted(), ChannelAccessManagerTest::NotifyChannelSwitching(), ChannelAccessManagerTest::NotifyCollision(), ChannelAccessManagerTest::NotifyInternalCollision(), ChannelAccessTestCase::Receive(), Ipv6RawSocketImplTest::ReceivePkt2(), Ipv6RipngSplitHorizonStrategyTest::ReceivePktProbe(), Ipv4RipSplitHorizonStrategyTest::ReceivePktProbe(), ns3::olsr::HelloRegressionTest::ReceivePktProbeA(), ns3::olsr::TcRegressionTest::ReceivePktProbeA(), ns3::olsr::HelloRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeC(), AredQueueDiscTestCase::RunAredDiscTest(), FifoQueueDiscTestCase::RunFifoTest(), PieQueueDiscTestCase::RunPieTest(), RedQueueDiscTestCase::RunRedTest(), TbfQueueDiscTestCase::RunTbfTest(), ChannelRoutingTestCase::SendIp(), ChannelRoutingTestCase::SendWsa(), ChannelRoutingTestCase::SendWsmp(), TcpTestCase::ServerHandleRecv(), TcpTestCase::ServerHandleSend(), TcpTestCase::SetupDefaultSim(), TcpTestCase::SetupDefaultSim6(), TcpTestCase::SourceHandleRecv(), TcpTestCase::SourceHandleSend(), ChannelAccessTestCase::TestAlternating(), ChannelAccessTestCase::TestAlternatingAfter(), ChannelAccessTestCase::TestContinuous(), ChannelAccessTestCase::TestContinuousAfter(), TcpOptionWSTestCase::TestDeserialize(), TcpOptionTSTestCase::TestDeserialize(), FlameRtableTest::TestExpire(), HwmpRtableTest::TestExpire(), ChannelAccessTestCase::TestExtended(), ChannelAccessTestCase::TestExtendedAfter(), ChannelCoordinationTestCase::TestIntervalAfter(), FlameRtableTest::TestLookup(), HwmpRtableTest::TestLookup(), WaypointInitialPositionIsWaypoint::TestNumWaypoints(), HwmpRtableTest::TestPrecursorFind(), TcpOptionWSTestCase::TestSerialize(), and TcpOptionTSTestCase::TestSerialize().
#define NS_TEST_EXPECT_MSG_EQ_TOL | ( | actual, | |
limit, | |||
tol, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (actual, limit, tol, msg, __FILE__, __LINE__) |
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if not.
Check to see if the expected (limit) value is equal to the actual value found in a test case to some tolerance. This is not the same thing as asking if two floating point are equal to within some epsilon, but is useful for that case. This assertion is geared toward more of a measurement problem. Consider measuring a physical rod of some kind that you have ordered. You need to determine if it is "good." You want to measure the rod to an arbitrary precision of sixteen significant figures, you will measure the rod to determine if its length is within the tolerances you provided. For example, 12.00 inches plus or minus .005 inch may be just fine.
In ns-3, you might want to measure a signal to noise ratio and check to see if the answer is what you expect. If you naively measure (double)1128.93 and compare this number with a constant 1128.93 you are almost certainly going to have your test fail because of floating point rounding errors. We provide a floating point comparison function ns3::TestDoubleIsEqual() but you will probably quickly find that is not what you want either. It may turn out to be the case that when you measured an SNR that printed as 1128.93, what was actually measured was something more like 1128.9287653857625442 for example. Given that the double epsilon is on the order of 0.0000000000000009, you would need to provide sixteen significant figures of expected value for this kind of test to pass even with a typical test for floating point "approximate equality." That is clearly not required or desired. You really want to be able to provide 1128.93 along with a tolerance just like you provided 12 inches +- 0.005 inch above.
This assertion is designed for real measurements by taking into account measurement tolerances. By doing so it also automatically compensates for floating point rounding errors. If you really want to check floating point equality down to the numeric_limits<double>::epsilon () range, consider using ns3::TestDoubleIsEqual().
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the expected value of the test. |
[in] | tol | Tolerance of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 565 of file test.h.
Referenced by ns3::int64x64::test::Int64x64HiLoTestCase::Check(), ns3::int64x64::test::Int64x64InputTestCase::Check(), ns3::int64x64::test::Int64x64InputOutputTestCase::Check(), RttEstimatorTestCase::CheckValuesWithTolerance(), SteadyStateRandomWaypointTest::DistribCompare(), OneVectorConstructorTestCase::DoRun(), DegreesToRadiansTestCase::DoRun(), IsotropicAntennaModelTestCase::DoRun(), HistogramTestCase::DoRun(), FriisPropagationLossModelTestCase::DoRun(), ParabolicAntennaModelTestCase::DoRun(), CosineAntennaModelTestCase::DoRun(), WifiOfdmMaskSlopesTestCase::DoRun(), RadiansToDegreesTestCase::DoRun(), TwoVectorsConstructorTestCase::DoRun(), TwoRayGroundPropagationLossModelTestCase::DoRun(), LogDistancePropagationLossModelTestCase::DoRun(), and RangePropagationLossModelTestCase::DoRun().
#define NS_TEST_EXPECT_MSG_GT | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_GT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than a limit and report if not.
Check to see if the actual value found in a test case is greater than the limit value. If the actual value is greater nothing happens, but if the check fails, an error is reported in a consistent way. EXPECT* macros do not return if an error is detected.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 1090 of file test.h.
Referenced by AnnexC_TestCase::Receive(), PieQueueDiscTestCase::RunPieTest(), and RedQueueDiscTestCase::RunRedTest().
#define NS_TEST_EXPECT_MSG_GT_OR_EQ | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_GT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is greater than or equal to limit and report if not.
Check to see if the actual value found in a test case is greater than or equal to the limit value. If the actual value is greater nothing happens, but if the check fails, an error is reported in a consistent way. EXPECT* macros do not return if an error is detected.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
#define NS_TEST_EXPECT_MSG_LT | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_LT_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than a limit and report if not.
Check to see if the actual value found in a test case is less than the limit value. If the actual value is lesser nothing happens, but if the check fails, an error is reported in a consistent way. EXPECT* macros do not return if an error is detected.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 903 of file test.h.
Referenced by Ns2MobilityHelperTest::CourseChange(), CosineAntennaModelTestCase::DoRun(), ParabolicAntennaModelTestCase::DoRun(), LrWpanAckTestCase::DoRun(), AnnexC_TestCase::Receive(), AredQueueDiscTestCase::RunAredDiscTest(), PieQueueDiscTestCase::RunPieTest(), and RedQueueDiscTestCase::RunRedTest().
#define NS_TEST_EXPECT_MSG_LT_OR_EQ | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_LT_OR_EQ_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual value is less than or equal to a limit and report if not.
Check to see if the actual value found in a test case is less than or equal to the limit value. If the actual value is lesser or equal nothing happens, but if the check fails, an error is reported in a consistent way. EXPECT* macros do not return if an error is detected.
The message is interpreted as a stream.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the limit value of the test. |
[in] | msg | Message that is output if the test does not pass. |
#define NS_TEST_EXPECT_MSG_NE | ( | actual, | |
limit, | |||
msg | |||
) | NS_TEST_EXPECT_MSG_NE_INTERNAL (actual, limit, msg, __FILE__, __LINE__) |
Test that an actual and expected (limit) value are not equal and report if not.
Check to see if the expected (limit) value is not equal to the actual value found in a test case. If the two values are not equal nothing happens, but if the comparison fails, an error is reported in a consistent way. EXPECT* macros do not return if an error is detected.
The message is interpreted as a stream, for example:
is legal.
[in] | actual | Expression for the actual value found during the test. |
[in] | limit | Expression for the value that actual is tested against. |
[in] | msg | Message that is output if the test does not pass. |
Definition at line 739 of file test.h.
Referenced by PacketTest::DoCheck(), LteUplinkDataSinrTestCase::DoRun(), Ipv4FragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), QueueDiscTracesTestCase::DoRun(), AredQueueDiscTestCase::RunAredDiscTest(), PieQueueDiscTestCase::RunPieTest(), RedQueueDiscTestCase::RunRedTest(), and UdpSocketImplTest::SentPkt().
bool ns3::TestDoubleIsEqual | ( | const double | a, |
const double | b, | ||
const double | epsilon = std::numeric_limits< double >::epsilon() |
||
) |
Compare two double precision floating point numbers and declare them equal if they are within some epsilon of each other.
Approximate comparison of floating point numbers near equality is trickier than one may expect and is well-discussed in the literature. Basic strategies revolve around a suggestion by Knuth to compare the floating point numbers as binary integers, supplying a maximum difference between them . This max difference is specified in Units in the Last Place (ulps) or a floating point epsilon.
This routine is based on the GNU Scientific Library function gsl_fcmp.
[in] | a | The first of double precision floating point numbers to compare |
[in] | b | The second of double precision floating point numbers to compare |
[in] | epsilon | The tolerance to use in the comparison. |
true
if the doubles are equal to a precision defined by epsilon Definition at line 44 of file test.cc.
References epsilon, max, and NS_LOG_FUNCTION.
Referenced by WifiOfdmMaskSlopesTestCase::InterpolateAndAppendValues().