|
|
| 462 |
return GetErrorStatus (); |
462 |
return GetErrorStatus (); |
| 463 |
} |
463 |
} |
| 464 |
|
464 |
|
|
|
465 |
class TwoLossTestCase : public TestCase |
| 466 |
{ |
| 467 |
public: |
| 468 |
TwoLossTestCase (); |
| 469 |
virtual ~TwoLossTestCase (); |
| 470 |
|
| 471 |
private: |
| 472 |
virtual bool DoRun (void); |
| 473 |
}; |
| 474 |
|
| 475 |
TwoLossTestCase::TwoLossTestCase () |
| 476 |
: TestCase ("Test TwoLoss") |
| 477 |
{ |
| 478 |
} |
| 479 |
|
| 480 |
TwoLossTestCase::~TwoLossTestCase () |
| 481 |
{ |
| 482 |
} |
| 483 |
|
| 484 |
bool |
| 485 |
TwoLossTestCase::DoRun (void) |
| 486 |
{ |
| 487 |
ObjectFactory a; |
| 488 |
ObjectFactory b; |
| 489 |
ObjectFactory ma; |
| 490 |
ObjectFactory mb; |
| 491 |
double txPower = 0.0; |
| 492 |
|
| 493 |
a.SetTypeId ("ns3::FixedRssLossModel"); |
| 494 |
a.Set ("Rss",DoubleValue(10.0)); |
| 495 |
b.SetTypeId ("ns3::FixedRssLossModel"); |
| 496 |
b.Set ("Rss",DoubleValue(20.0)); |
| 497 |
Ptr<PropagationLossModel> oneLoss = a.Create<PropagationLossModel> (); |
| 498 |
Ptr<PropagationLossModel> twoLoss = b.Create<PropagationLossModel> (); |
| 499 |
|
| 500 |
ma.SetTypeId ("ns3::ConstantPositionMobilityModel"); |
| 501 |
mb.SetTypeId ("ns3::ConstantPositionMobilityModel"); |
| 502 |
Ptr<MobilityModel> mobilitya = ma.Create<MobilityModel> (); |
| 503 |
Ptr<MobilityModel> mobilityb = mb.Create<MobilityModel> (); |
| 504 |
|
| 505 |
oneLoss->SetNext (twoLoss); |
| 506 |
double tolerance = 1e-6; |
| 507 |
double resultdBm = oneLoss->CalcRxPower(txPower,mobilitya,mobilityb); |
| 508 |
NS_TEST_EXPECT_MSG_EQ_TOL (resultdBm, 30.0, tolerance, "Added one and two; got unexpected rcv power"); |
| 509 |
|
| 510 |
return GetErrorStatus (); |
| 511 |
} |
| 512 |
|
| 465 |
class PropagationLossModelsTestSuite : public TestSuite |
513 |
class PropagationLossModelsTestSuite : public TestSuite |
| 466 |
{ |
514 |
{ |
| 467 |
public: |
515 |
public: |
|
|
| 476 |
AddTestCase (new LogDistancePropagationLossModelTestCase); |
524 |
AddTestCase (new LogDistancePropagationLossModelTestCase); |
| 477 |
AddTestCase (new MatrixPropagationLossModelTestCase); |
525 |
AddTestCase (new MatrixPropagationLossModelTestCase); |
| 478 |
AddTestCase (new RangePropagationLossModelTestCase); |
526 |
AddTestCase (new RangePropagationLossModelTestCase); |
|
|
527 |
AddTestCase (new TwoLossTestCase); |
| 479 |
} |
528 |
} |
| 480 |
|
529 |
|
| 481 |
PropagationLossModelsTestSuite WifiPropagationLossModelsTestSuite; |
530 |
PropagationLossModelsTestSuite WifiPropagationLossModelsTestSuite; |