/* -*- 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>
 */

#define BOOST_TEST_MAIN 1
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp> 
using boost::test_tools::output_test_stream;

#include "../model/sync-digest.h"
#include <iostream>
#include <sstream>

using namespace Sync;
using namespace Sync::Error;
using namespace std;
using namespace boost;

BOOST_AUTO_TEST_SUITE(DigestTests)

BOOST_AUTO_TEST_CASE (BasicTest)
{
  Digest d0;
  BOOST_REQUIRE (d0.empty ());
}

BOOST_AUTO_TEST_CASE (DigestGenerationTest)
{
  Digest d1;
  BOOST_CHECK_NO_THROW (d1 << "1\n");

  // without explicit finalizing, Digest will not be complete and printing out will cause assert
  BOOST_CHECK (d1.empty ());

  // fix hash
  d1.finalize ();
  
  BOOST_CHECK_NO_THROW (d1.getHash ());
  BOOST_CHECK (!d1.empty ());
  BOOST_CHECK (d1 == d1);

  BOOST_CHECK_THROW (d1 << "2", DigestCalculationError);
  
  output_test_stream output;
  BOOST_CHECK_NO_THROW (output << d1);
  BOOST_CHECK (output.check_length (40,false) );
  BOOST_CHECK (output.is_equal ("e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e", true));
}

BOOST_AUTO_TEST_CASE (DigestComparison)
{
  Digest d1;
  BOOST_CHECK_NO_THROW (d1 << "1\n");
  BOOST_CHECK_THROW (d1 == d1, DigestCalculationError);
  BOOST_CHECK_NO_THROW (d1.finalize ());
  BOOST_CHECK (d1 == d1);
  
  Digest d2;
  BOOST_CHECK_NO_THROW (d2 << "2\n");
  BOOST_CHECK_NO_THROW (d2.finalize ());
  BOOST_CHECK (d1 != d2);
  
  Digest d3;
  istringstream is (string ("e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e")); //real sha-1 for "1\n"
  BOOST_CHECK_NO_THROW (is >> d3);
  BOOST_CHECK (!d3.empty ());
  BOOST_CHECK (d3 == d1);
  BOOST_CHECK (d3 != d2);

  istringstream is2 (string ("25fa44f2b31c1fb553b6021e7360d07d5d91ff5e")); // some fake hash
  BOOST_CHECK_THROW (is2 >> d3, DigestCalculationError); // >> can be used only once

  Digest d4;
  BOOST_CHECK_THROW (is2 >> d4, DigestCalculationError); // is2 is now empty. empty >> is not allowed

  istringstream is3 (string ("25fa44f2b31c1fb553b6021e7360d07d5d91ff5e")); // some fake hash
  BOOST_CHECK_NO_THROW (is3 >> d4);
  
  BOOST_CHECK (d4 != d1);
  BOOST_CHECK (d4 != d2);
  BOOST_CHECK (d4 != d3);
}

BOOST_AUTO_TEST_SUITE_END()
