A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
rocketfuel-topology-reader-test-suite.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 Hajime Tazaki
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Hajime Tazaki (tazaki@sfc.wide.ad.jp)
19
*/
20
21
//-----------------------------------------------------------------------------
22
// Unit tests
23
//-----------------------------------------------------------------------------
24
25
#include "ns3/test.h"
26
#include "ns3/rocketfuel-topology-reader.h"
27
#include "ns3/log.h"
28
#include "ns3/abort.h"
29
#include "ns3/attribute.h"
30
#include "ns3/object-factory.h"
31
#include "ns3/object-factory.h"
32
#include "ns3/simulator.h"
33
34
namespace
ns3 {
35
36
class
RocketfuelTopologyReaderTest
:
public
TestCase
37
{
38
public
:
39
RocketfuelTopologyReaderTest
();
40
private
:
41
virtual
void
DoRun
(
void
);
42
};
43
44
RocketfuelTopologyReaderTest::RocketfuelTopologyReaderTest
()
45
:
TestCase
(
"RocketfuelTopologyReaderTest"
)
46
{
47
}
48
49
50
void
51
RocketfuelTopologyReaderTest::DoRun
(
void
)
52
{
53
Ptr<RocketfuelTopologyReader>
inFile;
54
NodeContainer
nodes
;
55
56
std::string input (
"./src/topology-read/examples/RocketFuel_toposample_1239_weights.txt"
);
57
58
inFile = CreateObject<RocketfuelTopologyReader> ();
59
inFile->SetFileName (input);
60
61
if
(inFile != 0)
62
{
63
nodes = inFile->Read ();
64
}
65
66
NS_TEST_ASSERT_MSG_NE
(nodes.
GetN
(), 0,
"Problems reading node information the topology file.."
);
67
68
NS_TEST_ASSERT_MSG_NE
(inFile->LinksSize (), 0,
"Problems reading the topology file."
);
69
70
NS_TEST_EXPECT_MSG_EQ
(nodes.
GetN
(),315,
"noes"
);
71
NS_TEST_EXPECT_MSG_EQ
(inFile->LinksSize (),972,
"links"
);
72
Simulator::Destroy
();
73
}
74
75
class
RocketfuelTopologyReaderTestSuite
:
public
TestSuite
76
{
77
public
:
78
RocketfuelTopologyReaderTestSuite
();
79
private
:
80
};
81
82
RocketfuelTopologyReaderTestSuite::RocketfuelTopologyReaderTestSuite
()
83
:
TestSuite
(
"rocketfuel-topology-reader"
, UNIT)
84
{
85
AddTestCase
(
new
RocketfuelTopologyReaderTest
(),
TestCase::QUICK
);
86
}
87
88
static
RocketfuelTopologyReaderTestSuite
rocketfuelTopologyReaderTestSuite
;
89
}
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::rocketfuelTopologyReaderTestSuite
static RocketfuelTopologyReaderTestSuite rocketfuelTopologyReaderTestSuite
Definition:
rocketfuel-topology-reader-test-suite.cc:88
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1025
NS_TEST_ASSERT_MSG_NE
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not...
Definition:
test.h:539
ns3::TestCase
encapsulates test code
Definition:
test.h:849
ns3::NodeContainer::GetN
uint32_t GetN(void) const
Get the number of Ptr
stored in this container.
Definition:
node-container.cc:83
first.nodes
tuple nodes
Definition:
first.py:25
NS_TEST_EXPECT_MSG_EQ
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition:
test.h:244
ns3::RocketfuelTopologyReaderTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
rocketfuel-topology-reader-test-suite.cc:51
ns3::Simulator::Destroy
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Definition:
simulator.cc:121
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:38
ns3::RocketfuelTopologyReaderTestSuite::RocketfuelTopologyReaderTestSuite
RocketfuelTopologyReaderTestSuite()
Definition:
rocketfuel-topology-reader-test-suite.cc:82
ns3::RocketfuelTopologyReaderTest
Definition:
rocketfuel-topology-reader-test-suite.cc:36
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition:
test.cc:173
ns3::RocketfuelTopologyReaderTest::RocketfuelTopologyReaderTest
RocketfuelTopologyReaderTest()
Definition:
rocketfuel-topology-reader-test-suite.cc:44
ns3::TestCase::QUICK
Fast test.
Definition:
test.h:857
ns3::RocketfuelTopologyReaderTestSuite
Definition:
rocketfuel-topology-reader-test-suite.cc:75
src
topology-read
test
rocketfuel-topology-reader-test-suite.cc
Generated on Sat Apr 19 2014 14:07:09 for ns-3 by
1.8.6