/* -*- 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 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
  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.getHash ());
  BOOST_CHECK (d1 == d1);
  
  Digest d2;
  BOOST_CHECK_NO_THROW (d2 << "2\n");
  BOOST_CHECK_NO_THROW (d2.getHash ());
  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()
