blob: 6fdc1a76cb57de67a1587f1426428d263799350a [file] [log] [blame]
Alexander Afanasyevec1e3952012-08-20 13:48:15 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011,2012 University of California, Los Angeles
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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#include "generic-tests.h"
22#include "ns3/core-module.h"
23#include "ns3/ndnSIM-module.h"
24#include "ns3/point-to-point-module.h"
25
26#include "../model/pit/ndn-pit-impl.h"
27#include "../utils/trie/persistent-policy.h"
28#include "../apps/ndn-producer.h"
29
30#include <boost/lexical_cast.hpp>
Alexander Afanasyev38ba9b22012-08-21 13:32:43 -070031#include <boost/shared_ptr.hpp>
32#include <boost/make_shared.hpp>
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070033
34using namespace std;
Alexander Afanasyev38ba9b22012-08-21 13:32:43 -070035using namespace boost;
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070036
37NS_LOG_COMPONENT_DEFINE ("ndn.test.Generic");
38
39namespace ns3 {
40namespace ndn {
41
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -070042struct Bla {
43};
44
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070045void
46GenericTests::DoRun ()
47{
48 NodeContainer nodes;
49 nodes.Create (2);
50
51 PointToPointHelper p2p;
52 p2p.Install (nodes);
53
54 StackHelper ndn;
55 ndn.SetDefaultRoutes (true);
56 ndn.Install (nodes);
57
58 Ptr<Node> node = nodes.Get (0);
59
60 Ptr<Pit> pit = node->GetObject<Pit> ();
61
62 Ptr<InterestHeader> header = Create<InterestHeader> ();
63 header->SetName (Create<NameComponents> ("/bla"));
64 header->SetInterestLifetime (Seconds (100));
65
66 Ptr<pit::Entry> e1 = pit->Create (header);
67 NS_ASSERT (e1 != 0);
68
69 header = Create<InterestHeader> ();
70 header->SetName (Create<NameComponents> ("/foo"));
71 header->SetInterestLifetime (Seconds (100));
72
73 Ptr<pit::Entry> e2 = pit->Create (header);
74 NS_ASSERT (e2 != 0);
75
76 list< Ptr< pit::Entry > > l;
77
78 l.push_back (e1);
79 l.push_back (e2);
80
81 BOOST_FOREACH (Ptr<pit::Entry> entry, l)
82 {
83 cout << "* " << entry->GetPrefix () << endl;
84 }
85
86 l.remove (e2);
87
88 BOOST_FOREACH (Ptr<pit::Entry> entry, l)
89 {
90 cout << "* " << entry->GetPrefix () << endl;
91 }
Alexander Afanasyev38ba9b22012-08-21 13:32:43 -070092
93
94 cerr << "===========\n\n";
95
Alexander Afanasyev38ba9b22012-08-21 13:32:43 -070096 shared_ptr<Bla> p1 = make_shared <Bla> ();
97 shared_ptr<Bla> p2 = make_shared <Bla> ();
98
99 if (p1 < p2)
100 {
101 cerr << "They are equal\n";
102 }
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700103
104
105 Time x = Seconds (-1);
106 cout << x << endl;
Alexander Afanasyevec1e3952012-08-20 13:48:15 -0700107}
108
109} // namespace ndn
110} // namespace ns3