Zhenkai Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 3 | * Copyright (c) 2012-2014 University of California, Los Angeles |
Zhenkai Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 5 | * This file is part of ChronoSync, synchronization library for distributed realtime |
| 6 | * applications for NDN. |
Zhenkai Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 7 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 8 | * 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 Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 11 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 12 | * 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 Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 15 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 16 | * 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 Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #include <boost/test/unit_test.hpp> |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 21 | #include <boost/test/output_test_stream.hpp> |
Zhenkai Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 22 | using boost::test_tools::output_test_stream; |
| 23 | #include <vector> |
| 24 | |
| 25 | #include <boost/make_shared.hpp> |
| 26 | |
Alexander Afanasyev | 158ec0d | 2012-04-05 13:48:55 -0700 | [diff] [blame] | 27 | #include "sync-interest-table.h" |
Alexander Afanasyev | f46eac5 | 2013-07-26 11:27:39 -0700 | [diff] [blame] | 28 | #include "sync-logging.h" |
Zhenkai Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 29 | |
| 30 | using namespace Sync; |
| 31 | using namespace std; |
| 32 | using namespace boost; |
| 33 | |
Alexander Afanasyev | 8e845ba | 2012-05-29 14:33:06 -0700 | [diff] [blame] | 34 | // 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 Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 44 | |
| 45 | BOOST_AUTO_TEST_CASE (SyncInterestTableTest) |
| 46 | { |
Alexander Afanasyev | 8e845ba | 2012-05-29 14:33:06 -0700 | [diff] [blame] | 47 | cerr << "SyncInterestTableTest is broken" << endl; |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame] | 48 | |
Alexander Afanasyev | 8e845ba | 2012-05-29 14:33:06 -0700 | [diff] [blame] | 49 | // INIT_LOGGERS (); |
| 50 | // INIT_LOGGER ("Test.Pit"); |
Zhenkai Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 51 | |
Alexander Afanasyev | 8e845ba | 2012-05-29 14:33:06 -0700 | [diff] [blame] | 52 | // 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 Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 57 | |
Alexander Afanasyev | 8e845ba | 2012-05-29 14:33:06 -0700 | [diff] [blame] | 58 | // str = sitToString(&sit); |
| 59 | // BOOST_CHECK_EQUAL(str, ""); |
Alexander Afanasyev | d3c501e | 2012-03-15 17:52:34 -0700 | [diff] [blame] | 60 | |
Alexander Afanasyev | 8e845ba | 2012-05-29 14:33:06 -0700 | [diff] [blame] | 61 | // _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 Zhu | a5d06d7 | 2012-03-09 15:16:24 -0800 | [diff] [blame] | 72 | } |