A Discrete-Event Network Simulator
API
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/simulator.h"
32 
33 using namespace ns3;
46 {
47 public:
49 private:
50  virtual void DoRun (void);
51 };
52 
54  : TestCase ("RocketfuelTopologyReaderTest")
55 {
56 }
57 
58 
59 void
61 {
64 
65  std::string input ("./src/topology-read/examples/RocketFuel_toposample_1239_weights.txt");
66 
67  inFile = CreateObject<RocketfuelTopologyReader> ();
68  inFile->SetFileName (input);
69 
70  if (inFile != 0)
71  {
72  nodes = inFile->Read ();
73  }
74 
75  NS_TEST_ASSERT_MSG_NE (nodes.GetN (), 0, "Problems reading node information the topology file..");
76 
77  NS_TEST_ASSERT_MSG_NE (inFile->LinksSize (), 0, "Problems reading the topology file.");
78 
79  NS_TEST_EXPECT_MSG_EQ (nodes.GetN (),315, "noes");
80  NS_TEST_EXPECT_MSG_EQ (inFile->LinksSize (),972, "links");
81  Simulator::Destroy ();
82 }
83 
91 {
92 public:
94 private:
95 };
96 
98  : TestSuite ("rocketfuel-topology-reader", UNIT)
99 {
100  AddTestCase (new RocketfuelTopologyReaderTest (), TestCase::QUICK);
101 }
102 
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
A suite of tests to run.
Definition: test.h:1342
#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:285
encapsulates test code
Definition: test.h:1155
static RocketfuelTopologyReaderTestSuite g_rocketfuelTopologyReaderTestSuite
Static variable for test initialization.
nodes
Definition: first.py:25
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
void SetFileName(const std::string &fileName)
Sets the input file name.
int LinksSize(void) const
Returns the number of links in this block.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
virtual NodeContainer Read(void)
Main topology reading function.
#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:624
virtual void DoRun(void)
Implementation to actually run this TestCase.