/* -*- 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: Zhenkai Zhu <zhenkai@cs.ucla.edu>
 *         Chaoyi Bian <bcy@pku.edu.cn>
 *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 */

#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp> 
using boost::test_tools::output_test_stream;
#include <vector>

#include <boost/make_shared.hpp>

#include "sync-interest-table.h"
#include "sync-log.h"

using namespace Sync;
using namespace std;
using namespace boost;

string sitToString(SyncInterestTable *sit) {
  vector<string> ent = sit->fetchAll();
  sort(ent.begin(), ent.end());
  string str = "";
  while(!ent.empty()){
    str += ent.back();
    ent.pop_back();
  }
  return str;
}

BOOST_AUTO_TEST_CASE (SyncInterestTableTest)
{
  INIT_LOGGERS ();
  INIT_LOGGER ("Test.Pit");

  SyncInterestTable sit;
  sit.insert("/ucla.edu/0");
  sit.insert("/ucla.edu/1");
  string str = sitToString(&sit);
  BOOST_CHECK_EQUAL(str, "/ucla.edu/1/ucla.edu/0");

  str = sitToString(&sit);
  BOOST_CHECK_EQUAL(str, "");

  _LOG_DEBUG ("Adding 0 and 1");
  sit.insert("/ucla.edu/0");
  sit.insert("/ucla.edu/1");
  sleep(2);
  _LOG_DEBUG ("Adding 0 and 2");
  sit.insert("/ucla.edu/0");
  sit.insert("/ucla.edu/2");
  sleep(3);
  _LOG_DEBUG ("Checking");
  str = sitToString(&sit);
  BOOST_CHECK_EQUAL(str, "/ucla.edu/2/ucla.edu/0");
}


