blob: 652a7f88a282a793546387ba53e5b144ee8ee040 [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
42void
43GenericTests::DoRun ()
44{
45 NodeContainer nodes;
46 nodes.Create (2);
47
48 PointToPointHelper p2p;
49 p2p.Install (nodes);
50
51 StackHelper ndn;
52 ndn.SetDefaultRoutes (true);
53 ndn.Install (nodes);
54
55 Ptr<Node> node = nodes.Get (0);
56
57 Ptr<Pit> pit = node->GetObject<Pit> ();
58
59 Ptr<InterestHeader> header = Create<InterestHeader> ();
60 header->SetName (Create<NameComponents> ("/bla"));
61 header->SetInterestLifetime (Seconds (100));
62
63 Ptr<pit::Entry> e1 = pit->Create (header);
64 NS_ASSERT (e1 != 0);
65
66 header = Create<InterestHeader> ();
67 header->SetName (Create<NameComponents> ("/foo"));
68 header->SetInterestLifetime (Seconds (100));
69
70 Ptr<pit::Entry> e2 = pit->Create (header);
71 NS_ASSERT (e2 != 0);
72
73 list< Ptr< pit::Entry > > l;
74
75 l.push_back (e1);
76 l.push_back (e2);
77
78 BOOST_FOREACH (Ptr<pit::Entry> entry, l)
79 {
80 cout << "* " << entry->GetPrefix () << endl;
81 }
82
83 l.remove (e2);
84
85 BOOST_FOREACH (Ptr<pit::Entry> entry, l)
86 {
87 cout << "* " << entry->GetPrefix () << endl;
88 }
Alexander Afanasyev38ba9b22012-08-21 13:32:43 -070089
90
91 cerr << "===========\n\n";
92
93 struct Bla {
94 };
95
96 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 Afanasyevec1e3952012-08-20 13:48:15 -0700103}
104
105} // namespace ndn
106} // namespace ns3