/*
* Project: MoleCuilder
* Description: creates and alters molecular systems
* Copyright (C) 2021 Frederik Heber. 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 .
*/
/*
* BindingModelUnitTest.cpp
*
* Created on: May 14, 2021
* Author: heber
*/
// include config.h
#ifdef HAVE_CONFIG_H
#include
#endif
using namespace std;
#include
#include
#include
#include "BindingModelUnitTest.hpp"
#include
#include
#include "CodePatterns/Assert.hpp"
#include "Fragmentation/Homology/HomologyGraph.hpp"
#include "Fragmentation/Graph.hpp"
#include "Potentials/BindingModel.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( BindingModelTest );
void BindingModelTest::setUp()
{
// failing asserts should be thrown
ASSERT_DO(Assert::Throw);
// add edges
edges += std::make_pair(FragmentEdge(8,1),2);
}
void BindingModelTest::tearDown()
{
}
/** UnitTest for operator<()
*/
void BindingModelTest::comparatorTest()
{
// create homology graph for a water molecule
BindingModel::vector_nodes_t vector_nodes;
vector_nodes += FragmentNode(8,2), FragmentNode(1,1), FragmentNode(1,1);
const BindingModel model(vector_nodes, edges);
{
// create homology graph for a bond potential between 8 and 1
HomologyGraph::edges_t twobody_edges;
twobody_edges += std::make_pair(FragmentEdge(8,1),1);
BindingModel::vector_nodes_t twobody_vector_nodes;
twobody_vector_nodes += FragmentNode(8,1), FragmentNode(1,1);
const BindingModel twobody_model(twobody_vector_nodes, twobody_edges);
CPPUNIT_ASSERT( model > twobody_model);
}
{
// create homology graph for a angle potential between 1, 8 and 1
HomologyGraph::edges_t threebody_edges;
threebody_edges += std::make_pair(FragmentEdge(8,1),2);
BindingModel::vector_nodes_t threebody_vector_nodes;
threebody_vector_nodes += FragmentNode(8,2), FragmentNode(1,1), FragmentNode(1,1);
const BindingModel threebody_model(threebody_vector_nodes, threebody_edges);
CPPUNIT_ASSERT( model == threebody_model);
}
}