blob: 39b36b96d6a4f935659c5c0edd1d60cf988ae961 [file] [log] [blame]
Zhenkai Zhua5d06d72012-03-09 15:16:24 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
Alexander Afanasyev8722d872014-07-02 13:00:29 -07003 * Copyright (c) 2012-2014 University of California, Los Angeles
Zhenkai Zhua5d06d72012-03-09 15:16:24 -08004 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -07005 * This file is part of ChronoSync, synchronization library for distributed realtime
6 * applications for NDN.
Zhenkai Zhua5d06d72012-03-09 15:16:24 -08007 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -07008 * ChronoSync is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation, either
10 * version 3 of the License, or (at your option) any later version.
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080011 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -070012 * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080015 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -070016 * You should have received a copy of the GNU General Public License along with
17 * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080018 */
19
20#include <boost/test/unit_test.hpp>
Alexander Afanasyev8722d872014-07-02 13:00:29 -070021#include <boost/test/output_test_stream.hpp>
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080022using boost::test_tools::output_test_stream;
23#include <vector>
24
25#include <boost/make_shared.hpp>
26
Alexander Afanasyev158ec0d2012-04-05 13:48:55 -070027#include "sync-interest-table.h"
Alexander Afanasyevf46eac52013-07-26 11:27:39 -070028#include "sync-logging.h"
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080029
30using namespace Sync;
31using namespace std;
32using namespace boost;
33
Alexander Afanasyev8e845ba2012-05-29 14:33:06 -070034// string sitToString(SyncInterestTable *sit) {
35// vector<string> ent = sit->fetchAll();
36// sort(ent.begin(), ent.end());
37// string str = "";
38// while(!ent.empty()){
39// str += ent.back();
40// ent.pop_back();
41// }
42// return str;
43// }
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080044
45BOOST_AUTO_TEST_CASE (SyncInterestTableTest)
46{
Alexander Afanasyev8e845ba2012-05-29 14:33:06 -070047 cerr << "SyncInterestTableTest is broken" << endl;
Alexander Afanasyev8722d872014-07-02 13:00:29 -070048
Alexander Afanasyev8e845ba2012-05-29 14:33:06 -070049 // INIT_LOGGERS ();
50 // INIT_LOGGER ("Test.Pit");
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080051
Alexander Afanasyev8e845ba2012-05-29 14:33:06 -070052 // SyncInterestTable sit;
53 // sit.insert("/ucla.edu/0");
54 // sit.insert("/ucla.edu/1");
55 // string str = sitToString(&sit);
56 // BOOST_CHECK_EQUAL(str, "/ucla.edu/1/ucla.edu/0");
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080057
Alexander Afanasyev8e845ba2012-05-29 14:33:06 -070058 // str = sitToString(&sit);
59 // BOOST_CHECK_EQUAL(str, "");
Alexander Afanasyevd3c501e2012-03-15 17:52:34 -070060
Alexander Afanasyev8e845ba2012-05-29 14:33:06 -070061 // _LOG_DEBUG ("Adding 0 and 1");
62 // sit.insert("/ucla.edu/0");
63 // sit.insert("/ucla.edu/1");
64 // sleep(2);
65 // _LOG_DEBUG ("Adding 0 and 2");
66 // sit.insert("/ucla.edu/0");
67 // sit.insert("/ucla.edu/2");
68 // sleep(3);
69 // _LOG_DEBUG ("Checking");
70 // str = sitToString(&sit);
71 // BOOST_CHECK_EQUAL(str, "/ucla.edu/2/ucla.edu/0");
Zhenkai Zhua5d06d72012-03-09 15:16:24 -080072}