[97ebf8] | 1 | /*
|
---|
| 2 | * analysisbondsunittest.cpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Nov 7, 2009
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[bf3817] | 8 | // include config.h
|
---|
| 9 | #ifdef HAVE_CONFIG_H
|
---|
| 10 | #include <config.h>
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
[97ebf8] | 13 | using namespace std;
|
---|
| 14 |
|
---|
| 15 | #include <cppunit/CompilerOutputter.h>
|
---|
| 16 | #include <cppunit/extensions/TestFactoryRegistry.h>
|
---|
| 17 | #include <cppunit/ui/text/TestRunner.h>
|
---|
| 18 |
|
---|
| 19 | #include <iostream>
|
---|
| 20 | #include <stdio.h>
|
---|
| 21 | #include <cstring>
|
---|
| 22 |
|
---|
| 23 | #include "MapOfActionsTest.hpp"
|
---|
| 24 | #include "Actions/MapOfActions.hpp"
|
---|
| 25 |
|
---|
| 26 | #ifdef HAVE_TESTRUNNER
|
---|
| 27 | #include "UnitTestMain.hpp"
|
---|
| 28 | #endif /*HAVE_TESTRUNNER*/
|
---|
| 29 |
|
---|
| 30 | /********************************************** Test classes **************************************/
|
---|
| 31 |
|
---|
| 32 | // Registers the fixture into the 'registry'
|
---|
| 33 | CPPUNIT_TEST_SUITE_REGISTRATION( MapOfActionsTest );
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | void MapOfActionsTest::setUp()
|
---|
| 37 | {
|
---|
| 38 | MapOfActions *ActionData = MapOfActions::getInstance();
|
---|
| 39 | };
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | void MapOfActionsTest::tearDown()
|
---|
| 43 | {
|
---|
| 44 | // note that all the atoms are cleaned by TestMolecule
|
---|
| 45 | MapOfActions::purgeInstance();
|
---|
| 46 | };
|
---|
| 47 |
|
---|
| 48 | /** UnitTest: check whether each short form action also has a description (the other way round is not always true)
|
---|
| 49 | */
|
---|
| 50 | void MapOfActionsTest::ShortFormConsistencyTest()
|
---|
| 51 | {
|
---|
| 52 | for (map<string, string>::iterator ShortFormRunner = ActionData->ShortFormMap.begin(); ShortFormRunner = ActionData->ShortFormMap.begin(); ++ShortFormRunner) {
|
---|
| 53 | CPPUNIT_ASSERT( ActionData->DescriptionMap.find(ShortFormRunner->first) != ActionData->DescriptionMap.end() && "There is a short form without description.");
|
---|
| 54 | }
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | /** UnitTest: check whether each action appears in a list one of the option lists
|
---|
| 58 | */
|
---|
| 59 | void MapOfActionsTest::OptionsListsConsistencyTest()
|
---|
| 60 | {
|
---|
| 61 | bool haveFound = false;
|
---|
| 62 | for (map<string, string>::iterator ActionRunner = ActionData->DescriptionMap.begin(); ShortFormRunner = ActionData->DescriptionMap.begin(); ++ShortFormRunner) {
|
---|
| 63 | haveFound = haveFound || (ActionData->generic.find(ActionRunner->first) != ActionData->generic.end());
|
---|
| 64 | haveFound = haveFound || (ActionData->config.find(ActionRunner->first) != ActionData->config.end());
|
---|
| 65 | haveFound = haveFound || (ActionData->hidden.find(ActionRunner->first) != ActionData->hidden.end());
|
---|
| 66 | haveFound = haveFound || (ActionData->visible.find(ActionRunner->first) != ActionData->visible.end());
|
---|
| 67 | CPPUNIT_ASSERT_EQUAL( true , haveFound);
|
---|
| 68 | }
|
---|
| 69 | };
|
---|
| 70 |
|
---|