[deddf6] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
| 9 | * ActionRegistryUnitTest.cpp
|
---|
| 10 | *
|
---|
| 11 | * Created on: Dec 15, 2010
|
---|
| 12 | * Author: heber
|
---|
| 13 | */
|
---|
| 14 |
|
---|
| 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
| 20 | #include <cppunit/CompilerOutputter.h>
|
---|
| 21 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
| 22 | #include <cppunit/ui/text/TestRunner.h>
|
---|
| 23 |
|
---|
| 24 | #include "ActionRegistryUnitTest.hpp"
|
---|
| 25 |
|
---|
| 26 | #include <typeinfo>
|
---|
| 27 |
|
---|
| 28 | #include "Actions/ActionRegistry.hpp"
|
---|
[3139b2] | 29 | #include "Actions/ActionTrait.hpp"
|
---|
[deddf6] | 30 | #include "Actions/OptionRegistry.hpp"
|
---|
| 31 | #include "Actions/OptionTrait.hpp"
|
---|
| 32 |
|
---|
[ce7fdc] | 33 | using namespace MoleCuilder;
|
---|
| 34 |
|
---|
[deddf6] | 35 | #ifdef HAVE_TESTRUNNER
|
---|
| 36 | #include "UnitTestMain.hpp"
|
---|
| 37 | #endif /*HAVE_TESTRUNNER*/
|
---|
| 38 |
|
---|
| 39 | /********************************************** Test classes **************************************/
|
---|
| 40 |
|
---|
| 41 | // Registers the fixture into the 'registry'
|
---|
| 42 | CPPUNIT_TEST_SUITE_REGISTRATION( ActionRegistryTest );
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 | void ActionRegistryTest::setUp()
|
---|
| 46 | {};
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | void ActionRegistryTest::tearDown()
|
---|
| 50 | {};
|
---|
| 51 |
|
---|
| 52 | void ActionRegistryTest::CheckDoublyUsedShortforms()
|
---|
| 53 | {
|
---|
| 54 | std::map <std::string, std::string> result;
|
---|
| 55 |
|
---|
| 56 | ActionRegistry &AR = ActionRegistry::getInstance();
|
---|
[455573] | 57 | for (ActionRegistry::const_iterator iter = AR.getBeginIter(); iter != AR.getEndIter(); ++iter) {
|
---|
[deddf6] | 58 | if ((iter->second)->Traits.hasShortForm()) {
|
---|
| 59 | ASSERT(result.find((iter->second)->Traits.getShortForm()) == result.end(),
|
---|
| 60 | "Short form "+toString((iter->second)->Traits.getShortForm())+
|
---|
| 61 | " for action "+toString(iter->first)+" already present from "+
|
---|
| 62 | std::string(result[(iter->second)->Traits.getShortForm()])+"!");
|
---|
| 63 | result[(iter->second)->Traits.getShortForm()] = (iter->second)->getName();
|
---|
| 64 | }
|
---|
[455573] | 65 | }
|
---|
[deddf6] | 66 | }
|
---|