/*
* Project: MoleCuilder
* Description: creates and alters molecular systems
* Copyright (C) 2012 University of Bonn. All rights reserved.
*
*
* This file is part of MoleCuilder.
*
* MoleCuilder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* MoleCuilder 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 MoleCuilder. If not, see .
*/
/*
* FunctionArgumentUnitTest.cpp
*
* Created on: Oct 16, 2012
* Author: heber
*/
// include config.h
#ifdef HAVE_CONFIG_H
#include
#endif
using namespace std;
#include
#include
#include
#include "FunctionArgumentUnitTest.hpp"
#include
#include "CodePatterns/Assert.hpp"
#include "FunctionApproximation/FunctionArgument.hpp"
#include "Potentials/helpers.hpp"
using namespace boost::assign;
#ifdef HAVE_TESTRUNNER
#include "UnitTestMain.hpp"
#endif /*HAVE_TESTRUNNER*/
/********************************************** Test classes **************************************/
// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( FunctionArgumentTest );
void FunctionArgumentTest::setUp()
{
// failing asserts should be thrown
ASSERT_DO(Assert::Throw);
}
void FunctionArgumentTest::tearDown()
{
}
/** UnitTest for IndexComparator()
*/
void FunctionArgumentTest::IndexComparatorTest()
{
argument_t arg( std::make_pair(1,2), 0. );
argument_t otherarg( std::make_pair(1,3), 0. );
argument_t anotherarg( std::make_pair(0,1), 0. );
CPPUNIT_ASSERT( argument_t::IndexComparator(arg, otherarg) );
CPPUNIT_ASSERT( !argument_t::IndexComparator(arg, anotherarg) );
CPPUNIT_ASSERT( !argument_t::IndexComparator(otherarg, anotherarg) );
}
/** UnitTest for DistanceComparator()
*/
void FunctionArgumentTest::DistanceComparatorTest()
{
argument_t arg( 0.5 );
argument_t otherarg( 0.9 );
argument_t anotherarg( 1.4 );
CPPUNIT_ASSERT( argument_t::DistanceComparator(arg, otherarg) );
CPPUNIT_ASSERT( argument_t::DistanceComparator(arg, anotherarg) );
CPPUNIT_ASSERT( argument_t::DistanceComparator(otherarg, anotherarg) );
}