/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    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 LICENSE and COPYING files for more details.
*/

#include <boost/test/unit_test.hpp>
#include <test_utils/utils.h>

BOOST_AUTO_TEST_CASE(loading_crs)
{
	Matrices::SuperMatrixPtr testMatrix1 = Matrices::IO::LoadSuperMatrix(TEST_DATA_DIR,"landauer",false,true);
	Matrices::SuperMatrixPtr testMatrix2 = getTestMatrix();

	matrixCompareCRS(testMatrix1, testMatrix2);
}

BOOST_AUTO_TEST_CASE(loading_ccs)
{
	Matrices::SuperMatrixPtr testMatrix1 = Matrices::IO::LoadSuperMatrix(TEST_DATA_DIR,"landauer",true,false);
	Matrices::SuperMatrixPtr testMatrix2 = getTestMatrix();

	matrixCompareCCS(testMatrix1, testMatrix2);
}

BOOST_AUTO_TEST_CASE(filtered_no_filter_crs)
{
	Matrices::SuperMatrixPtr testMatrix1 = Matrices::IO::LoadSuperMatrixFiltered(
			std::string(TEST_DATA_DIR) + "landauer/words_to_filter.txt", TEST_DATA_DIR, "landauer",
			false, true, false, false);
	Matrices::SuperMatrixPtr testMatrix2 = getTestMatrix();
	matrixCompareCRS(testMatrix1, testMatrix2);
}

BOOST_AUTO_TEST_CASE(filtered_no_filter_ccs)
{
	Matrices::SuperMatrixPtr testMatrix1 = Matrices::IO::LoadSuperMatrixFiltered(
			std::string(TEST_DATA_DIR) + "landauer/words_to_filter.txt", TEST_DATA_DIR, "landauer",
			true, false, false, false);
	Matrices::SuperMatrixPtr testMatrix2 = getTestMatrix();
	matrixCompareCCS(testMatrix1, testMatrix2);
}

BOOST_AUTO_TEST_CASE(filtered_crs_row)
{
	Matrices::SuperMatrixPtr testMatrix1 = Matrices::IO::LoadSuperMatrixFiltered(
			std::string(TEST_DATA_DIR) + "landauer/words_to_filter.txt", TEST_DATA_DIR, "landauer",
			false, true, true, false);
	Matrices::SuperMatrixPtr testMatrix2 = getTestMatrixFilteredRow();
	matrixCompareCRS(testMatrix1, testMatrix2);
}

BOOST_AUTO_TEST_CASE(filtered_ccs_col)
{
	Matrices::SuperMatrixPtr testMatrix1 = Matrices::IO::LoadSuperMatrixFiltered(
			std::string(TEST_DATA_DIR) + "landauer/words_to_filter_col.txt", TEST_DATA_DIR, "landauer",
			true, false, false, true);
	Matrices::SuperMatrixPtr testMatrix2 = getTestMatrixFilteredCol();
	matrixCompareCCS(testMatrix1, testMatrix2);
}
