tests: moving trie.cc from examples to test (not really working yet)
diff --git a/examples/trie.cc b/test/ndnSIM-trie.cc
similarity index 76%
rename from examples/trie.cc
rename to test/ndnSIM-trie.cc
index ffd2858..ed8356e 100644
--- a/examples/trie.cc
+++ b/test/ndnSIM-trie.cc
@@ -20,6 +20,9 @@
#include "ns3/core-module.h"
#include "ns3/ndnSIM-module.h"
+
+#include "ndnSIM-trie.h"
+
#include "../utils/trie/trie-with-policy.h"
#include "../utils/trie/lru-policy.h"
#include "../utils/trie/random-policy.h"
@@ -52,12 +55,10 @@
// return os;
// }
-int
-main (int argc, char *argv[])
+void
+TrieTest::DoRun ()
{
- CommandLine args;
- args.Parse (argc, argv);
-
+ cerr << "TrieTest is temporarily broken" << endl;
// typedef trie_with_policy<
// ns3::NdnNameComponents,
// smart_pointer_payload_traits<Integer>,
@@ -96,29 +97,29 @@
// std::cout << x.getTrie ();
// std::cout << "}\n";
- Ptr<Node> node = CreateObject<Node> ();
- Names::Add ("TestNode", node);
- Ptr<ndn::App> app = CreateObject<ndn::App> ();
- node->AddApplication (app);
+ // Ptr<Node> node = CreateObject<Node> ();
+ // Names::Add ("TestNode", node);
+ // Ptr<ndn::App> app = CreateObject<ndn::App> ();
+ // node->AddApplication (app);
- ObjectFactory factory ("ns3::ndn::fib::Default");
+ // ObjectFactory factory ("ns3::ndn::fib::Default");
- Ptr<ndn::Fib> fib = factory.Create<ndn::Fib> ();
- node->AggregateObject (fib);
- Ptr<ndn::Face> face = CreateObject<ndn::AppFace> (app);
+ // Ptr<ndn::Fib> fib = factory.Create<ndn::Fib> ();
+ // node->AggregateObject (fib);
+ // Ptr<ndn::Face> face = CreateObject<ndn::AppFace> (app);
- fib->Add (lexical_cast<ndn::NameComponents> ("/bla"), face, 1);
- fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1"), face, 1);
- fib->Add (lexical_cast<ndn::NameComponents> ("/bla/2"), face, 1);
- fib->Add (lexical_cast<ndn::NameComponents> ("/bla/3"), face, 1);
- fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1/1"), face, 1);
- fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1/2"), face, 1);
+ // fib->Add (lexical_cast<ndn::NameComponents> ("/bla"), face, 1);
+ // fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1"), face, 1);
+ // fib->Add (lexical_cast<ndn::NameComponents> ("/bla/2"), face, 1);
+ // fib->Add (lexical_cast<ndn::NameComponents> ("/bla/3"), face, 1);
+ // fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1/1"), face, 1);
+ // fib->Add (lexical_cast<ndn::NameComponents> ("/bla/1/2"), face, 1);
- cout << *fib << endl;
+ // cout << *fib << endl;
- fib->RemoveFromAll (face);
+ // fib->RemoveFromAll (face);
- cout << *fib << endl;
+ // cout << *fib << endl;
// BOOST_FOREACH (const trie::parent_trie &item, x.getPolicy ())
// {
// std::cout << *item.payload () << " " << std::endl;
@@ -140,7 +141,5 @@
// x->PrintStat (std::cout);
// delete x;
-
- return 0;
}
diff --git a/test/ndnSIM-trie.h b/test/ndnSIM-trie.h
new file mode 100644
index 0000000..6cf5190
--- /dev/null
+++ b/test/ndnSIM-trie.h
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *
+ */
+
+#ifndef NDNSIM_TRIE_H
+#define NDNSIM_TRIE_H
+
+#include "ns3/test.h"
+
+namespace ns3
+{
+
+class TrieTest : public TestCase
+{
+public:
+ TrieTest ()
+ : TestCase ("Trie Test")
+ {
+ }
+
+private:
+ virtual void DoRun ();
+};
+
+}
+
+#endif // NDNSIM_TRIE_H