/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-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 . */ /* * ActionRegistryUnitTest.cpp * * Created on: Dec 15, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "ActionRegistryUnitTest.hpp" #include #include "Actions/ActionQueue.hpp" #include "Actions/ActionRegistry.hpp" #include "Actions/ActionTrait.hpp" #include "Actions/OptionRegistry.hpp" #include "Actions/OptionTrait.hpp" using namespace MoleCuilder; #ifdef HAVE_TESTRUNNER #include "UnitTestMain.hpp" #endif /*HAVE_TESTRUNNER*/ /********************************************** Test classes **************************************/ // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( ActionRegistryTest ); void ActionRegistryTest::setUp() { }; void ActionRegistryTest::tearDown() { ActionQueue::purgeInstance(); }; void ActionRegistryTest::CheckDoublyUsedShortforms() { std::map result; ActionQueue &AQ = ActionQueue::getInstance(); ActionQueue::ActionTokens_t tokens = AQ.getListOfActions(); for (ActionQueue::ActionTokens_t::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter) { const ActionTrait &CurrentTrait = AQ.getActionsTrait(*iter); if (CurrentTrait.hasShortForm()) { ASSERT(result.find(CurrentTrait.getShortForm()) == result.end(), "Short form "+toString(CurrentTrait.getShortForm())+ " for action "+toString(*iter)+" already present from "+ std::string(result[CurrentTrait.getShortForm()])+"!"); result[CurrentTrait.getShortForm()] = *iter; } } }