Changes in / [d223d5:255971]
- Files:
-
- 2 deleted
- 44 edited
-
Makefile.am (modified) (1 diff)
-
doc/molecuilder_logo.png (deleted)
-
doc/molecuilder_logo.xcf (deleted)
-
src/Actions/AnalysisAction/PointCorrelationAction.hpp (modified) (1 diff)
-
src/Actions/CmdAction/FastParsingAction.cpp (modified) (1 diff)
-
src/Actions/CmdAction/VerboseAction.cpp (modified) (1 diff)
-
src/Actions/FragmentationAction/SubgraphDissectionAction.hpp (modified) (1 diff)
-
src/Actions/Makefile.am (modified) (1 diff)
-
src/Actions/MapOfActions.hpp (modified) (1 diff)
-
src/Actions/SelectionAction/NotAllAtomsAction.cpp (modified) (3 diffs)
-
src/Actions/WorldAction/SetDefaultNameAction.cpp (modified) (1 diff)
-
src/Actions/WorldAction/SetGaussianBasisAction.cpp (modified) (1 diff)
-
src/Exceptions/Makefile.am (modified) (1 diff)
-
src/Formula.cpp (modified) (5 diffs)
-
src/Formula.hpp (modified) (4 diffs)
-
src/Helpers/Assert.cpp (modified) (5 diffs)
-
src/Helpers/Assert.hpp (modified) (5 diffs)
-
src/Helpers/Log.hpp (modified) (1 diff)
-
src/Helpers/Makefile.am (modified) (1 diff)
-
src/Helpers/MemDebug.cpp (modified) (4 diffs)
-
src/Helpers/MemDebug.hpp (modified) (2 diffs)
-
src/Helpers/helpers.hpp (modified) (1 diff)
-
src/LinearAlgebra/Makefile.am (modified) (1 diff)
-
src/LinearAlgebra/linearsystemofequations.hpp (modified) (2 diffs)
-
src/Makefile.am (modified) (10 diffs)
-
src/Parser/Makefile.am (modified) (1 diff)
-
src/Parser/TremoloParser.cpp (modified) (1 diff)
-
src/UIElements/Makefile.am (modified) (1 diff)
-
src/UIElements/QT4/QTDialog.cpp (modified) (1 diff)
-
src/UIElements/TextUI/TextDialog.cpp (modified) (2 diffs)
-
src/UIElements/TextUI/TextWindow.cpp (modified) (1 diff)
-
src/World.cpp (modified) (3 diffs)
-
src/atom.cpp (modified) (3 diffs)
-
src/atom.hpp (modified) (2 diffs)
-
src/builder.cpp (modified) (3 diffs)
-
src/defs.hpp (modified) (1 diff)
-
src/element.cpp (modified) (2 diffs)
-
src/element.hpp (modified) (3 diffs)
-
src/molecule.cpp (modified) (11 diffs)
-
src/molecule.hpp (modified) (1 diff)
-
src/unittests/ActionSequenceTest.cpp (modified) (1 diff)
-
src/unittests/FormulaUnittest.cpp (modified) (2 diffs)
-
src/unittests/Makefile.am (modified) (1 diff)
-
src/unittests/ShapeUnittest.cpp (modified) (1 diff)
-
test_all.sh (modified) (1 diff)
-
tests/Tesselations/Makefile.am (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
rd223d5 r255971 9 9 doc: 10 10 cd doc && make doxygen-docs 11 12 unity:13 cd src && make unity -
src/Actions/AnalysisAction/PointCorrelationAction.hpp
rd223d5 r255971 11 11 #include "Actions/Action.hpp" 12 12 #include "LinearAlgebra/Vector.hpp" 13 #include <vector>14 #include <string>15 13 16 14 class element; -
src/Actions/CmdAction/FastParsingAction.cpp
rd223d5 r255971 78 78 79 79 Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){ 80 returnperformUndo(_state);80 performUndo(_state); 81 81 } 82 82 -
src/Actions/CmdAction/VerboseAction.cpp
rd223d5 r255971 76 76 77 77 Action::state_ptr CommandLineVerboseAction::performRedo(Action::state_ptr _state){ 78 returnperformUndo(_state);78 performUndo(_state); 79 79 } 80 80 -
src/Actions/FragmentationAction/SubgraphDissectionAction.hpp
rd223d5 r255971 7 7 8 8 #ifndef SUBGRAPHDISSECTIONACTION_HPP_ 9 #define SUBGRAPHDISSECTIONACTION_HPP_ 9 #define SUBGRAPHDISSECTIONACTION_HPP_f 10 10 11 11 #include "Actions/Action.hpp" -
src/Actions/Makefile.am
rd223d5 r255971 209 209 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc 210 210 211 unity.cpp:212 echo "" > unity.cpp; \213 list='$(ACTIONSSOURCE)'; for file in $$list; do \214 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \215 done;216 217 MOSTLYCLEANFILES = unity.cpp -
src/Actions/MapOfActions.hpp
rd223d5 r255971 10 10 11 11 #include <boost/program_options.hpp> 12 #include <boost/lexical_cast.hpp>13 12 14 13 #include <map> -
src/Actions/SelectionAction/NotAllAtomsAction.cpp
rd223d5 r255971 28 28 // memento to remember the state when undoing 29 29 30 class Selection NotAllAtomsState : public ActionState {30 class SelectionAllAtomsState : public ActionState { 31 31 public: 32 Selection NotAllAtomsState(std::vector<atom*> _selectedAtoms) :32 SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) : 33 33 selectedAtoms(_selectedAtoms) 34 34 {} … … 61 61 DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms." << endl); 62 62 World::getInstance().clearAtomSelection(); 63 return Action::state_ptr(new Selection NotAllAtomsState(selectedAtoms));63 return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms)); 64 64 } 65 65 66 66 Action::state_ptr SelectionNotAllAtomsAction::performUndo(Action::state_ptr _state) { 67 Selection NotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());67 SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get()); 68 68 69 69 World::getInstance().clearAtomSelection(); … … 71 71 World::getInstance().selectAtom(*iter); 72 72 73 return Action::state_ptr(new Selection NotAllAtomsState(state->selectedAtoms));73 return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms)); 74 74 } 75 75 76 76 Action::state_ptr SelectionNotAllAtomsAction::performRedo(Action::state_ptr _state){ 77 Selection NotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());77 SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get()); 78 78 79 79 World::getInstance().clearAtomSelection(); 80 80 81 return Action::state_ptr(new Selection NotAllAtomsState(state->selectedAtoms));81 return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms)); 82 82 } 83 83 -
src/Actions/WorldAction/SetDefaultNameAction.cpp
rd223d5 r255971 79 79 80 80 Action::state_ptr WorldSetDefaultNameAction::performRedo(Action::state_ptr _state){ 81 returnperformUndo(_state);81 performUndo(_state); 82 82 } 83 83 -
src/Actions/WorldAction/SetGaussianBasisAction.cpp
rd223d5 r255971 79 79 80 80 Action::state_ptr WorldSetGaussianBasisAction::performRedo(Action::state_ptr _state){ 81 returnperformUndo(_state);81 performUndo(_state); 82 82 } 83 83 -
src/Exceptions/Makefile.am
rd223d5 r255971 72 72 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc 73 73 74 unity.cpp:75 echo "" > unity.cpp; \76 list='$(EXCEPTIONSOURCE)'; for file in $$list; do \77 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \78 done;79 80 MOSTLYCLEANFILES = unity.cpp -
src/Formula.cpp
rd223d5 r255971 55 55 56 56 void Formula::fromString(const std::string &formula) throw(ParseError){ 57 // make this transactional, in case an error is thrown58 Formula res;59 string::const_iterator begin = formula.begin();60 string::const_iterator end = formula.end();61 res.parseFromString(begin,end,static_cast<char>(0));62 (*this)=res;63 }64 65 int Formula::parseMaybeNumber(string::const_iterator &it,string::const_iterator &end) throw(ParseError){66 static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));67 int count = 0;68 while(it!=end && Numbers.isInRange(*it))69 count = (count*10) + ((*it++)-Numbers.first);70 // one is implicit71 count = (count!=0)?count:1;72 return count;73 }74 75 void Formula::parseFromString(string::const_iterator &it,string::const_iterator &end,char delimiter) throw(ParseError){76 57 // some constants needed for parsing... Assumes ASCII, change if other encodings are used 77 58 static const range<char> CapitalLetters = makeRange('A',static_cast<char>('Z'+1)); 78 59 static const range<char> SmallLetters = makeRange('a',static_cast<char>('z'+1)); 79 map<char,char> delimiters; 80 delimiters['('] = ')'; 81 delimiters['['] = ']'; 60 static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1)); 82 61 // clean the formula 83 62 clear(); 84 for(/*send from above*/;it!=end && *it!=delimiter;/*updated in loop*/){ 85 // we might have a sub formula 86 if(delimiters.count(*it)){ 87 Formula sub; 88 char nextdelim=delimiters[*it]; 89 sub.parseFromString(++it,end,nextdelim); 90 if(!sub.getElementCount()){ 91 throw(ParseError(__FILE__,__LINE__)); 92 } 93 int count = parseMaybeNumber(++it,end); 94 addFormula(sub,count); 95 continue; 96 } 63 string::const_iterator end = formula.end(); // will be used frequently 64 for(string::const_iterator it=formula.begin();it!=end;){ 97 65 string shorthand; 98 66 // Atom names start with a capital letter … … 103 71 while(it!=end && SmallLetters.isInRange(*it)) 104 72 shorthand+=(*it++); 105 int count = parseMaybeNumber(it,end); 73 // now we can count the occurences 74 int count = 0; 75 while(it!=end && Numbers.isInRange(*it)) 76 count = (count*10) + ((*it++)-Numbers.first); 77 // one is implicit 78 count = (count!=0)?count:1; 106 79 // test if the shorthand exists 107 80 if(!World::getInstance().getPeriode()->FindElement(shorthand)) … … 110 83 addElements(shorthand,count); 111 84 } 112 if(it==end && delimiter!=0){113 throw(ParseError(__FILE__,__LINE__));114 }115 85 } 116 86 … … 123 93 *output << "#Ion_TypeNr.\tAmount\tZ\tRGauss\tL_Max(PP)L_Loc(PP)IonMass\t# chemical name, symbol" << endl; 124 94 for(const_iterator iter=begin(); iter!=end();++iter){ 95 (*iter).first->No = No; 125 96 result = result && (*iter).first->Checkout(output, No++, (*iter).second); 126 97 } … … 224 195 } 225 196 226 void Formula::addFormula(const Formula &formula,unsigned int n){227 for(Formula::const_iterator iter=formula.begin();iter!=formula.end();++iter){228 this->addElements(iter->first,iter->second*n);229 }230 }231 232 enumeration<Formula::key_type> Formula::enumerateElements() const{233 enumeration<key_type> res(1);234 for(Formula::const_iterator iter=begin();iter!=end();++iter){235 res.add(iter->first);236 }237 return res;238 }239 240 197 const unsigned int Formula::operator[](const element *element) const{ 241 198 ASSERT(element,"Invalid pointer in access of Formula"); -
src/Formula.hpp
rd223d5 r255971 16 16 17 17 #include "types.hpp" 18 #include "Helpers/helpers.hpp"19 18 20 19 class element; … … 23 22 { 24 23 public: 25 typedef const element*key_type;24 typedef element* key_type; 26 25 typedef unsigned int mapped_type; 27 26 typedef std::pair<key_type, mapped_type> value_type; … … 66 65 67 66 unsigned int getElementCount() const; 68 bool hasElement( key_type)const;67 bool hasElement(const element*) const; 69 68 bool hasElement(atomicNumber_t) const; 70 69 bool hasElement(const std::string&) const; 71 70 72 void operator+=( key_type);71 void operator+=(const element*); 73 72 void operator+=(atomicNumber_t); 74 73 void operator+=(const std::string&); 75 74 76 void operator-=( key_type);75 void operator-=(const element*); 77 76 void operator-=(atomicNumber_t); 78 77 void operator-=(const std::string&); 79 78 80 void addElements( key_type,unsigned int);79 void addElements(const element*,unsigned int); 81 80 void addElements(atomicNumber_t,unsigned int); 82 81 void addElements(const std::string&,unsigned int); 83 82 84 void addFormula(const Formula&,unsigned int);85 86 enumeration<key_type> enumerateElements() const;87 88 83 // only const versions, because someone might try to increment a previously 89 84 // not set element 90 const unsigned int operator[]( key_type) const;85 const unsigned int operator[](const element*) const; 91 86 const unsigned int operator[](atomicNumber_t) const; 92 87 const unsigned int operator[](std::string) const; … … 103 98 104 99 private: 105 void parseFromString(std::string::const_iterator&,std::string::const_iterator&,char) throw(ParseError);106 int parseMaybeNumber(std::string::const_iterator &it,std::string::const_iterator &end) throw(ParseError);107 100 // this contains all counts of elements in the formula 108 101 // the size of the actual structure might be used in comparisons -
src/Helpers/Assert.cpp
rd223d5 r255971 5 5 * Author: crueger 6 6 */ 7 8 #include "Helpers/MemDebug.hpp" 7 9 8 10 #include "Helpers/Assert.hpp" … … 44 46 } 45 47 48 using namespace Assert; 49 46 50 #ifndef NDEBUG 47 51 48 #ifdef __GNUC__ 49 #include <cstdlib> 50 #include <execinfo.h> 51 #include <cxxabi.h> 52 #endif 52 Action _my_assert::defaultAction = Ask; 53 std::vector<Assert::hook_t> _my_assert::hooks; 53 54 54 Assert::Action Assert::_my_assert::defaultAction = Ask; 55 std::vector<Assert::hook_t> Assert::_my_assert::hooks; 55 std::map<std::string,bool> _wrapper::ignores; 56 const char* _wrapper::message_ptr = "source pointer did not point to object of desired type"; 57 const char* _wrapper::message_ref = "source reference did not contain object of desired type"; 56 58 57 std::map<std::string,bool> Assert::_wrapper::ignores;58 const char* Assert::_wrapper::message_ptr = "source pointer did not point to object of desired type";59 const char* Assert::_wrapper::message_ref = "source reference did not contain object of desired type";60 59 61 bool Assert::_my_assert::check(const char* condition, 62 const char* message, 63 const char* filename, 64 const int line, 65 bool& ignore) 60 bool _my_assert::check(const bool res, 61 const char* condition, 62 const char* message, 63 const char* filename, 64 const int line, 65 bool& ignore) 66 66 { 67 cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl; 68 cout << "Assertion Message: " << message << std::endl; 69 while(true){ 70 char choice; 71 if(defaultAction==Assert::Ask) { 72 #ifdef __GNUC__ 73 cout << "Please choose: (a)bort, (t)hrow execption, show (b)actrace, (i)gnore, al(w)ays ignore" << endl; 74 #else 75 cout << "Please choose: (a)bort, (t)hrow execption, (i)gnore, al(w)ays ignore" << endl; 76 #endif /* __GNUC__ */ 77 cin >> choice; 78 } 79 else{ 80 choice = ActionKeys[defaultAction]; 81 } 82 switch(choice){ 83 case 'a': 84 return true; 85 break; 86 case 't': 87 throw AssertionFailure(condition,filename,line,message); 88 break; 89 #ifdef __GNUC__ 90 case 'b': 91 Assert::_my_assert::backtrace(filename,line); 92 break; 93 #endif /* __GNUC__ */ 94 case 'w': 95 ignore = true; 96 // fallthrough 97 case 'i': 98 return false; 99 break; 67 if(!res){ 68 cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl; 69 cout << "Assertion Message: " << message << std::endl; 70 while(true){ 71 char choice; 72 if(defaultAction==Ask) { 73 cout << "Please choose: (a)bort, (t)hrow execption, (i)gnore, al(w)ays ignore" << endl; 74 cin >> choice; 75 } 76 else{ 77 choice = ActionKeys[defaultAction]; 78 } 79 switch(choice){ 80 case 'a': 81 return true; 82 break; 83 case 't': 84 throw AssertionFailure(condition,filename,line,message); 85 break; 86 case 'w': 87 ignore = true; 88 // fallthrough 89 case 'i': 90 return false; 91 break; 92 } 100 93 } 101 94 } … … 103 96 } 104 97 105 #ifdef __GNUC__ 106 void Assert::_my_assert::backtrace(const char *file, int line){ 107 const size_t max_depth = 100; 108 void* stack_addrs[max_depth]; 109 size_t stack_depth; 110 char **stack_strings=0; 111 const char *func_name=0; 112 size_t sz = 64; 113 114 // get the backtrace 115 stack_depth = ::backtrace(stack_addrs,max_depth); 116 stack_strings = backtrace_symbols(stack_addrs, stack_depth); 117 // used later for demangling 118 // reserved here, so we can free it unconditionally 119 char *dm_function = static_cast<char*>(malloc(sz)); 120 if(!dm_function){ 121 // malloc failed... we are out of luck 122 cout << "cannot provide stack trace due to exhausted memory" << endl; 123 return; 124 } 125 126 cout << "Backtrace from " << file << "@" << line << ":" << endl; 127 128 // i=2 because we don't want this function, nor the assertion handler 129 for(unsigned int i=2;i<stack_depth-2;++i){ 130 // find the mangled function name 131 char *begin = stack_strings[i]; 132 // function name starts with a ( 133 while(*begin && *begin!='(') ++begin; 134 char *end=begin; 135 while(*end && *end!='+') ++end; 136 137 // see if we found our function name 138 if(*begin && *end){ 139 *begin++ = 0; 140 *end = 0; 141 // use the C++ demangler 142 143 int status; 144 char *func_ret = abi::__cxa_demangle(begin, dm_function, &sz, &status); 145 if(func_ret){ 146 // abi might have realloced... 147 dm_function = func_ret; 148 func_name = dm_function; 149 } 150 else{ 151 // demangling failed... get the function name without demangling 152 func_name = begin; 153 } 154 } 155 else{ 156 // function name not found... get the whole line 157 func_name = stack_strings[i]; 158 } 159 cout << func_name << endl; 160 } 161 free(dm_function); 162 free(stack_strings); // malloc()ed by backtrace_symbols 163 } 164 #endif /* __GNUC__ */ 165 166 void Assert::_my_assert::doHooks(){ 98 void _my_assert::doHooks(){ 167 99 for(vector<hook_t>::reverse_iterator iter = hooks.rbegin(); iter!=hooks.rend(); ++iter ){ 168 100 (*iter)(); … … 170 102 } 171 103 172 void Assert::_my_assert::addHook(hook_t hook){104 void _my_assert::addHook(hook_t hook){ 173 105 hooks.push_back(hook); 174 106 } 175 107 176 void Assert::_my_assert::removeHook(Assert::hook_t hook){108 void _my_assert::removeHook(Assert::hook_t hook){ 177 109 for(vector<hook_t>::iterator iter = hooks.begin(); iter!=hooks.end();){ 178 110 if((*iter)==hook){ … … 185 117 } 186 118 187 void Assert::_my_assert::setDefault(Assert::Action action){119 void _my_assert::setDefault(Assert::Action action){ 188 120 defaultAction = action; 189 121 } 190 Assert::Action Assert::_my_assert::getDefault(){122 Assert::Action _my_assert::getDefault(){ 191 123 return defaultAction; 192 124 } 193 std::string Assert::_my_assert::printDefault(){125 std::string _my_assert::printDefault(){ 194 126 return ActionNames[defaultAction]; 195 127 } -
src/Helpers/Assert.hpp
rd223d5 r255971 234 234 static bool ignore = false;\ 235 235 if(!ignore){\ 236 if( !(condition) && Assert::_my_assert::check(STRINGIFY(condition),(message),\237 __FILE__,__LINE__,ignore)){\236 if(Assert::_my_assert::check((condition),STRINGIFY(condition),(message),\ 237 __FILE__,__LINE__,ignore)){\ 238 238 Assert::_my_assert::doHooks();\ 239 239 DEBUG_BREAK;\ … … 247 247 static bool ignore = false; \ 248 248 if(!ignore){\ 249 if(Assert::_my_assert::check( "Exception caught",(message),__FILE__,__LINE__,ignore)){\249 if(Assert::_my_assert::check(false,"Exception caught",(message),__FILE__,__LINE__,ignore)){\ 250 250 Assert::_my_assert::doHooks();\ 251 DEBUG_BREAK;\251 DEBUG_BREAK;\ 252 252 }\ 253 253 }\ … … 299 299 class _my_assert{ 300 300 public: 301 static bool check(const char* condition, 301 static bool check(const bool res, 302 const char* condition, 302 303 const char* message, 303 304 const char* filename, 304 305 const int line, 305 306 bool& ignore); 306 #ifdef __GNUC__307 static void backtrace(const char *file, int line);308 #endif /* __GNUC__ */309 307 static void addHook(Assert::hook_t hook); 310 308 static void removeHook(Assert::hook_t hook); … … 334 332 335 333 if(!ignore){ 336 bool res = dynamic_cast<target>(src)==static_cast<target>(src);337 if(!res && _my_assert::check("type-safe typecast",message_ptr,file,line,ignore)){334 if(_my_assert::check(dynamic_cast<target>(src)==static_cast<target>(src),"type-safe typecast", 335 message_ptr,file,line,ignore)){ 338 336 _my_assert::doHooks(); 339 337 DEBUG_BREAK; … … 356 354 catch(...){ 357 355 if(!ignore){ 358 if(_my_assert::check( "type-safe typecast",message_ref,file,line,ignore)){356 if(_my_assert::check(0,"type-safe typecast",message_ref,file,line,ignore)){ 359 357 _my_assert::doHooks(); 360 358 DEBUG_BREAK; -
src/Helpers/Log.hpp
rd223d5 r255971 12 12 #include "Helpers/logger.hpp" 13 13 14 class logger &Log();15 class errorLogger &eLog();14 class logger * Log(); 15 class errorLogger * eLog(); 16 16 void setVerbosity(int verbosityLevel); 17 17 bool DoLog(int verbose); -
src/Helpers/Makefile.am
rd223d5 r255971 69 69 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc 70 70 71 unity.cpp:72 echo "" > unity.cpp; \73 list='$(HELPERSSOURCE)'; for file in $$list; do \74 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \75 done;76 77 MOSTLYCLEANFILES = unity.cpp -
src/Helpers/MemDebug.cpp
rd223d5 r255971 72 72 // all allocated memory blocks 73 73 struct entry_t { 74 typedef unsigned int checksum_t;75 74 // we seperate the tracking info from the rest 76 75 // A checksum will be calculated for this part of … … 91 90 } info; 92 91 bool isIgnored; 93 ch ecksum_tchecksum;92 char checksum; 94 93 entry_t *prev; 95 94 entry_t *next; … … 118 117 // calculates a simple checksum for the info block 119 118 // the checksum is used to find memory corruptions 120 inline entry_t::checksum_tcalcChecksum(entry_t::info_t *info){119 inline char calcChecksum(entry_t::info_t *info){ 121 120 char *buffer = (char*)info; 122 entry_t::checksum_tchecksum =0;121 char checksum =0; 123 122 for(size_t i=0;i<sizeof(entry_t::info_t);i++){ 124 123 checksum+=buffer[i]; … … 155 154 cout << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl; 156 155 #endif 157 }158 }159 160 void dumpMemory(std::ostream &ost){161 ost << "Maximum allocated Memory: " << max << " bytes" << endl;162 ost << "Maximum allocated Memory: " << max << " bytes" << endl;163 ost << "Currently allocated Memory: " << state <<" bytes" << endl;164 ost << allocs << " allocated chunks total" << endl;165 bool corrupted=false;166 for(entry_t *pos=begin;pos;pos=pos->next){167 ost << "\nChunk of " << pos->info.nbytes << " bytes" << " still available" << endl;168 # ifdef __GNUC__169 ost << "Chunk reserved at: " << pos->info.function170 << " (" << pos->info.file << ":" << pos->info.line << ")" << endl;171 # else172 ost << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl;173 # endif174 ost << "Chunk address: " << pos->info.location << endl;175 entry_t::checksum_t checksum = calcChecksum(&pos->info);176 ost << "Checksum of chunk: " << checksum << endl;177 ost << "Checksum at allocation time: " << pos->checksum << endl;178 if(checksum!=pos->checksum){179 ost << "!!!Chunk was corrupted!!!" << endl;180 corrupted=true;181 }182 }183 if(corrupted){184 ost << "\n!!!Memory corruption detected!!!" << endl;185 156 } 186 157 } -
src/Helpers/MemDebug.hpp
rd223d5 r255971 61 61 */ 62 62 void getState(); 63 void dumpMemory(std::ostream&);64 63 65 64 void _ignore(void*); … … 101 100 102 101 #else 103 104 #include <iosfwd>105 106 102 // memory debugging was disabled 107 103 108 104 namespace Memory { 109 inline void getState(){}; 110 111 inline void dumpMemory(std::ostream&){}; 105 inline void getState(){} 112 106 113 107 template <typename T> -
src/Helpers/helpers.hpp
rd223d5 r255971 194 194 }; 195 195 196 /************ struct to contain simple enumerations ***************/197 template <class C>198 struct enumeration{199 enumeration() : max(0) {}200 enumeration(unsigned int i) : max(i) {}201 enumeration(const enumeration &src) :202 there(src.there),203 back(src.back),204 max(src.max)205 {}206 enumeration &operator=(const enumeration &src){207 /* no self-assignment check needed */208 there = src.there;209 back = src.back;210 max = src.max;211 return *this;212 }213 void add(const C &value){214 if(!there.count(value)){215 there[value]=max;216 back[max++]=value;217 }218 }219 unsigned int getMax() const{220 return max;221 }222 223 map<C,unsigned int> there;224 map<unsigned int,C> back;225 private:226 unsigned int max;227 };228 229 /***** A counter to generate sequential numbers *******************/230 struct counter{231 inline counter() : count(0){};232 inline counter(int i) : count(i){};233 inline unsigned int operator()(){234 return count++;235 }236 private:237 unsigned int count;238 };239 240 template <class C,class ForwardIterator>241 enumeration<C> enumerate(ForwardIterator first,ForwardIterator last){242 enumeration<C> res;243 for_each(first,last,bind1st(mem_fun(&enumeration<C>::add),&res));244 return res;245 }246 247 196 #endif /*HELPERS_HPP_*/ -
src/LinearAlgebra/Makefile.am
rd223d5 r255971 71 71 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc 72 72 73 unity.cpp:74 echo "" > unity.cpp; \75 list='$(LINALGSOURCE)'; for file in $$list; do \76 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \77 done;78 79 MOSTLYCLEANFILES = unity.cpp -
src/LinearAlgebra/linearsystemofequations.hpp
rd223d5 r255971 6 6 */ 7 7 8 #ifndef LINEARSYSTEMSOFEQUATIONS_HPP 9 #define LINEARSYSTEMSOFEQUATIONS_HPP 8 using namespace std; 10 9 11 10 /*********************************************** includes ***********************************/ … … 56 55 bool IsSymmetric; 57 56 }; 58 59 #endif /* LINEARSYSTEMSOFEQUATIONS_HPP */ -
src/Makefile.am
rd223d5 r255971 4 4 SUBDIRS = Actions Exceptions Helpers LinearAlgebra Parser UIElements 5 5 6 6 7 ATOMSOURCE = \ 7 8 atom.cpp \ … … 72 73 Shapes/Shape.hpp \ 73 74 Shapes/ShapeOps.hpp 74 75 75 76 77 QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \ 78 UIElements/QT4/QTMainWindow.hpp \ 79 UIElements/Menu/QT4/QTMenu.hpp \ 80 UIElements/Views/QT4/QTWorldView.hpp \ 81 UIElements/Views/QT4/GLMoleculeView.hpp \ 82 UIElements/Views/QT4/QTMoleculeView.hpp \ 83 UIElements/Views/QT4/QTStatusBar.hpp 84 85 QTUIMOC_TARGETS = QTMainWindow.moc.cpp \ 86 QTMenu.moc.cpp\ 87 QTDialog.moc.cpp \ 88 QTWorldView.moc.cpp \ 89 GLMoleculeView.moc.cpp \ 90 QTMoleculeView.moc.cpp \ 91 QTStatusBar.moc.cpp 92 76 93 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \ 77 94 Descriptors/AtomIdDescriptor.cpp \ … … 96 113 Descriptors/MoleculePtrDescriptor.hpp \ 97 114 Descriptors/MoleculeSelectionDescriptor.cpp 98 99 100 QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \101 UIElements/QT4/QTMainWindow.hpp \102 UIElements/Menu/QT4/QTMenu.hpp \103 UIElements/Views/QT4/QTWorldView.hpp \104 UIElements/Views/QT4/GLMoleculeView.hpp \105 UIElements/Views/QT4/QTMoleculeView.hpp \106 UIElements/Views/QT4/QTStatusBar.hpp107 115 108 QTUISOURCE = allmocs.moc.cpp\116 QTUISOURCE = ${QTUIMOC_TARGETS} \ 109 117 UIElements/QT4/QTMainWindow.cpp \ 110 118 UIElements/QT4/QTDialog.cpp \ … … 128 136 ${SHAPESOURCE} \ 129 137 ${DESCRIPTORSOURCE} \ 138 ${HELPERSOURCE} \ 130 139 bond.cpp \ 131 140 bondgraph.cpp \ … … 220 229 ## from each source file. Note that it is not necessary to list header files 221 230 ## which are already listed elsewhere in a _HEADERS variable assignment. 222 libMolecuilder_@MOLECUILDER_API_VERSION@_la_SOURCES = ${MOLECUILDERSOURCE} $(srcdir)/version.c231 libMolecuilder_@MOLECUILDER_API_VERSION@_la_SOURCES = ${MOLECUILDERSOURCE} $(srcdir)/version.c 223 232 224 233 ## Instruct libtool to include ABI version information in the generated shared … … 255 264 noinst_LIBRARIES = libmenu.a 256 265 bin_PROGRAMS = molecuilder molecuildergui joiner analyzer 257 EXTRA_PROGRAMS = unity258 266 259 267 molecuilderdir = ${bindir} … … 284 292 molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT 285 293 molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS} 286 287 unity_SOURCES = unity.cpp288 unity_LDADD = $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}289 290 294 molecuildergui_LDADD = \ 291 295 UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \ … … 325 329 # Therfore `%'-rules do not seem to work 326 330 #Quick fix to get it done otherwise 327 allmocs.moc.cpp: ${QTUIMOC_HEADER} 328 echo "" > allmocs.moc.cpp;\ 331 ${QTUIMOC_TARGETS}: ${QTUIMOC_HEADER} 329 332 list='$(QTUIMOC_HEADER)'; for header in $$list; do \ 330 333 echo "Making mocfile for $$header"; \ … … 332 335 $(MOC) $(srcdir)/$$header -o $$target \ 333 336 || eval $$failcom; \ 334 echo "#include \"$$target\"" >> allmocs.moc.cpp; \335 337 done; 336 338 339 MOSTLYCLEANFILES = ${QTUIMOC_TARGETS} 340 337 341 #EXTRA_DIST = ${molecuilder_DATA} 338 342 … … 353 357 354 358 355 unity.cpp: ${MOLECUILDERSOURCE} ${MOLECUILDERHEADER}356 echo "" > unity.cpp; \357 list='$(MOLECUILDERSOURCE)'; for file in $$list; do \358 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \359 done; \360 subdirs='$(SUBDIRS)';for directory in $$subdirs; do\361 olddir=$$PWD;\362 cd $$directory && make unity.cpp;\363 cd $$olddir;\364 echo "#include \"$$directory/unity.cpp\"" >> unity.cpp;\365 done;\366 echo "#include \"$(srcdir)/builder.cpp\"" >> unity.cpp;367 echo "#include \"$(srcdir)/version.c\"" >> unity.cpp;368 369 MOSTLYCLEANFILES = allmocs.moc.cpp unity.cpp370 -
src/Parser/Makefile.am
rd223d5 r255971 66 66 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc 67 67 68 unity.cpp:69 echo "" > unity.cpp; \70 list='$(PARSERSOURCE)'; for file in $$list; do \71 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \72 done;73 74 MOSTLYCLEANFILES = unity.cpp -
src/Parser/TremoloParser.cpp
rd223d5 r255971 21 21 22 22 using namespace std; 23 using namespace boost; 23 24 24 25 /** -
src/UIElements/Makefile.am
rd223d5 r255971 118 118 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc 119 119 120 unity.cpp:121 echo "" > unity.cpp; \122 list='$(UISOURCE)'; for file in $$list; do \123 echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \124 done;125 126 MOSTLYCLEANFILES = unity.cpp -
src/UIElements/QT4/QTDialog.cpp
rd223d5 r255971 7 7 8 8 #include "UIElements/QT4/QTDialog.hpp" 9 10 #include <boost/lexical_cast.hpp>11 9 12 10 #include <string> -
src/UIElements/TextUI/TextDialog.cpp
rd223d5 r255971 28 28 #include "LinearAlgebra/Matrix.hpp" 29 29 #include "Box.hpp" 30 31 #include <boost/lexical_cast.hpp>32 30 33 31 using namespace std; … … 525 523 } 526 524 } 527 return true;528 525 } 529 526 -
src/UIElements/TextUI/TextWindow.cpp
rd223d5 r255971 25 25 #include "Views/StreamStringView.hpp" 26 26 #include "Views/MethodStringView.hpp" 27 #include "Helpers/MemDebug.hpp" 27 28 28 29 #include "defs.hpp" -
src/World.cpp
rd223d5 r255971 32 32 33 33 using namespace std; 34 35 const unsigned int MAX_POOL_FRAGMENTATION=20;36 const unsigned int MAX_FRAGMENTATION_SKIPS=100;37 34 38 35 /******************************* getter and setter ************************/ … … 721 718 delete cell_size; 722 719 delete molecules_deprecated; 720 delete periode; 721 delete configuration; 722 delete Thermostats; 723 723 MoleculeSet::iterator molIter; 724 724 for(molIter=molecules.begin();molIter!=molecules.end();++molIter){ … … 731 731 } 732 732 atoms.clear(); 733 delete periode;734 delete configuration;735 delete Thermostats;736 733 } 737 734 -
src/atom.cpp
rd223d5 r255971 19 19 20 20 #include <iomanip> 21 #include <iostream>22 21 23 22 /************************************* Functions for class atom *************************************/ … … 110 109 }; 111 110 112 bool atom::isFather(const atom *ptr){113 return ptr==father;114 }115 116 111 /** Checks whether atom is within the given box. 117 112 * \param offset offset to box origin … … 166 161 * \return true - \a *out present, false - \a *out is NULL 167 162 */ 168 bool atom::OutputArrayIndexed(ostream * const out, const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const163 bool atom::OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment) const 169 164 { 170 165 AtomNo[type->Z]++; // increment number 171 166 if (out != NULL) { 172 cout << "Looking for atom with element " << *type << endl; 173 ASSERT(elementLookup.there.find(type)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration"); 174 *out << "Ion_Type" << elementLookup.there.find(type)->second << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint; 167 *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint; 175 168 *out << x[0] << "\t" << x[1] << "\t" << x[2]; 176 169 *out << "\t" << FixedIon; -
src/atom.hpp
rd223d5 r255971 52 52 53 53 bool OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment = NULL) const; 54 bool OutputArrayIndexed(ostream * const out, const enumeration<const element*>&, int *AtomNo, const char *comment = NULL) const;54 bool OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment = NULL) const; 55 55 bool OutputXYZLine(ofstream *out) const; 56 56 bool OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const; … … 61 61 62 62 void EqualsFather ( const atom *ptr, const atom **res ) const; 63 bool isFather(const atom *ptr);64 63 void CorrectFather(); 65 64 atom *GetTrueFather(); -
src/builder.cpp
rd223d5 r255971 110 110 } 111 111 112 void dumpMemory(){113 ofstream ost("molecuilder.memdump");114 Memory::dumpMemory(ost);115 }116 117 112 int main(int argc, char **argv) 118 113 { 119 114 // while we are non interactive, we want to abort from asserts 120 ASSERT_DO(Assert::Abort); 121 ASSERT_HOOK(dumpMemory); 115 //ASSERT_DO(Assert::Abort); 122 116 string line; 123 117 char **Arguments = NULL; … … 133 127 // need to init the history before any action is created 134 128 ActionHistory::init(); 129 130 // In the interactive mode, we can leave the user the choice in case of error 131 ASSERT_DO(Assert::Ask); 135 132 136 133 // from this moment on, we need to be sure to deeinitialize in the correct order … … 158 155 UIFactory::makeUserInterface("CommandLine"); 159 156 } else { 160 // In the interactive mode, we can leave the user the choice in case of error161 ASSERT_DO(Assert::Ask);162 157 #ifdef USE_GUI_QT 163 158 DoLog(0) && (Log() << Verbose(0) << "Setting UI to QT4." << endl); -
src/defs.hpp
rd223d5 r255971 84 84 #define MOLECUILDER_NAME "Molecuilder" 85 85 86 const extern unsigned int MAX_POOL_FRAGMENTATION;87 const extern unsigned int MAX_FRAGMENTATION_SKIPS;86 const unsigned int MAX_POOL_FRAGMENTATION=20; 87 const unsigned int MAX_FRAGMENTATION_SKIPS=100; 88 88 89 89 #endif /*DEFS_HPP_*/ -
src/element.cpp
rd223d5 r255971 26 26 next(NULL), 27 27 sort(NULL), 28 No(-1), 28 29 Valence(0), 29 30 NoValenceOrbitals(0) … … 69 70 return string(symbol); 70 71 } 71 72 std::string element::getName() const{73 return string(name);74 }75 76 std::ostream &operator<<(std::ostream &ost,const element &elem){77 ost << elem.getName() << "(" << elem.getNumber() << ")";78 return ost;79 } -
src/element.hpp
rd223d5 r255971 41 41 element *next; //!< next element in list 42 42 int *sort; //!< sorc criteria 43 int No; //!< number of element set on periodentafel::Output() 43 44 double Valence; //!< number of valence electrons for this element 44 45 int NoValenceOrbitals; //!< number of valence orbitals, used for determining bond degree in molecule::CreateConnectmatrix() … … 52 53 atomicNumber_t getNumber() const; 53 54 std::string getSymbol() const; 54 std::string getName() const;55 55 56 56 //> print element entries to screen … … 61 61 }; 62 62 63 std::ostream &operator<<(std::ostream&,const element&);64 63 65 64 #endif /* ELEMENT_HPP_ */ -
src/molecule.cpp
rd223d5 r255971 151 151 molecule::const_iterator molecule::erase( const_iterator loc ) 152 152 { 153 OBSERVE;154 153 molecule::const_iterator iter = loc; 155 154 iter--; … … 157 156 atomIds.erase( atom->getId() ); 158 157 atoms.remove( atom ); 159 formula-=atom->type;160 158 atom->removeFromMolecule(); 161 159 return iter; … … 164 162 molecule::const_iterator molecule::erase( atom * key ) 165 163 { 166 OBSERVE;167 164 molecule::const_iterator iter = find(key); 168 165 if (iter != end()){ 169 166 atomIds.erase( key->getId() ); 170 167 atoms.remove( key ); 171 formula-=key->type;172 168 key->removeFromMolecule(); 173 169 } … … 187 183 pair<molecule::iterator,bool> molecule::insert ( atom * const key ) 188 184 { 189 OBSERVE;190 185 pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId()); 191 186 if (res.second) { // push atom if went well 192 187 atoms.push_back(key); 193 formula+=key->type;194 188 return pair<iterator,bool>(molecule::iterator(--end()),res.second); 195 189 } else { … … 239 233 if (pointer != NULL) { 240 234 atom *walker = pointer->clone(); 241 formula += walker->type;242 235 walker->setName(pointer->getName()); 243 236 walker->nr = last_atom++; // increase number within molecule … … 626 619 { 627 620 molecule *copy = World::getInstance().createMolecule(); 621 atom *LeftAtom = NULL, *RightAtom = NULL; 628 622 629 623 // copy all atoms 630 for_each(atoms.begin(),atoms.end(),bind1st(mem_fun(&molecule::AddCopyAtom),copy));624 ActOnCopyWithEachAtom ( &molecule::AddCopyAtom, copy ); 631 625 632 626 // copy all bonds 627 bond *Binder = NULL; 628 bond *NewBond = NULL; 633 629 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 634 630 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin()) 635 631 if ((*BondRunner)->leftatom == *AtomRunner) { 636 bond *Binder = (*BondRunner);632 Binder = (*BondRunner); 637 633 638 634 // get the pendant atoms of current bond in the copy molecule 639 atomSet::iterator leftiter=find_if(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->leftatom)); 640 atomSet::iterator rightiter=find_if(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->rightatom)); 641 ASSERT(leftiter!=atoms.end(),"No original left atom for bondcopy found"); 642 ASSERT(leftiter!=atoms.end(),"No original right atom for bondcopy found"); 643 atom *LeftAtom = *leftiter; 644 atom *RightAtom = *rightiter; 645 646 bond *NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree); 635 copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->leftatom, (const atom **)&LeftAtom ); 636 copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->rightatom, (const atom **)&RightAtom ); 637 638 NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree); 647 639 NewBond->Cyclic = Binder->Cyclic; 648 640 if (Binder->Cyclic) … … 651 643 } 652 644 // correct fathers 653 for_each(atoms.begin(),atoms.end(),mem_fun(&atom::CorrectFather));645 ActOnAllAtoms( &atom::CorrectFather ); 654 646 655 647 // copy values … … 860 852 * \param *out output stream 861 853 */ 862 bool molecule::Output(ostream * const output) 863 { 854 bool molecule::Output(ofstream * const output) 855 { 856 int ElementNo[MAX_ELEMENTS], AtomNo[MAX_ELEMENTS]; 857 858 for (int i=0;i<MAX_ELEMENTS;++i) { 859 AtomNo[i] = 0; 860 ElementNo[i] = 0; 861 } 864 862 if (output == NULL) { 865 863 return false; 866 864 } else { 867 int AtomNo[MAX_ELEMENTS];868 memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo));869 enumeration<const element*> elementLookup = formula.enumerateElements();870 for(map<const element*,unsigned int>::iterator iter=elementLookup.there.begin();871 iter!=elementLookup.there.end();++iter){872 cout << "Enumerated element " << *iter->first << " with number " << iter->second << endl;873 }874 865 *output << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; 875 for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0)); 866 SetIndexedArrayForEachAtomTo ( ElementNo, &element::Z, &AbsoluteValue, 1); 867 int current=1; 868 for (int i=0;i<MAX_ELEMENTS;++i) { 869 if (ElementNo[i] == 1) 870 ElementNo[i] = current++; 871 } 872 ActOnAllAtoms( &atom::OutputArrayIndexed, (ostream * const) output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL ); 876 873 return true; 877 874 } … … 916 913 { 917 914 DoLog(2) && (Log() << Verbose(2) << endl << "From Contents of ListOfBonds, all non-hydrogen atoms:" << endl); 918 for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputBondOfAtom));915 ActOnAllAtoms (&atom::OutputBondOfAtom ); 919 916 DoLog(0) && (Log() << Verbose(0) << endl); 920 917 }; … … 939 936 for (int step=0;step<MDSteps;step++) { 940 937 *output << getAtomCount() << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now); 941 for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectoryXYZ,_1,output,step));938 ActOnAllAtoms( &atom::OutputTrajectoryXYZ, output, step ); 942 939 } 943 940 return true; … … 956 953 now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time' 957 954 *output << getAtomCount() << "\n\tCreated by molecuilder on " << ctime(&now); 958 for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputXYZLine),output));955 ActOnAllAtoms( &atom::OutputXYZLine, output ); 959 956 return true; 960 957 } else -
src/molecule.hpp
rd223d5 r255971 341 341 342 342 // Output routines. 343 bool Output( std::ostream * const output);343 bool Output(ofstream * const output); 344 344 bool OutputTrajectories(ofstream * const output); 345 345 void OutputListOfBonds() const; -
src/unittests/ActionSequenceTest.cpp
rd223d5 r255971 243 243 244 244 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 245 CPPUNIT_ASSERT_EQUAL(true,wasCalled 2->wasCalled());245 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 246 246 247 247 ActionHistory::getInstance().undoLast(); 248 248 249 249 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 250 CPPUNIT_ASSERT_EQUAL(false,wasCalled 2->wasCalled());251 252 } 253 254 250 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 251 252 } 253 254 -
src/unittests/FormulaUnittest.cpp
rd223d5 r255971 185 185 } 186 186 { 187 Formula formula("CH2(COOH)2");188 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)4);189 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)4);190 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)3);191 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);192 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);193 }194 {195 Formula formula("K4[Fe(CN)6]");196 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0);197 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0);198 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)6);199 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);200 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);201 CPPUNIT_ASSERT_EQUAL(formula["K"],(unsigned int)4);202 CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1);203 CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)6);204 }205 {206 Formula formula("[CrCl3(H2O)3]");207 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)6);208 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)3);209 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)0);210 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);211 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);212 CPPUNIT_ASSERT_EQUAL(formula["Cr"],(unsigned int)1);213 CPPUNIT_ASSERT_EQUAL(formula["Cl"],(unsigned int)3);214 }215 {216 Formula formula("Mg3[Fe(CN)6]2");217 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0);218 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0);219 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)12);220 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);221 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);222 CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)3);223 CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)2);224 CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)12);225 }226 {227 Formula formula("Na[Fe((HO2CCH2)2NCH2CH2N(CH2CO2H)2)]");228 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)16);229 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)8);230 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)10);231 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)1);232 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);233 CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)0);234 CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1);235 CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)2);236 }237 {238 187 CPPUNIT_ASSERT_THROW(Formula formula("74107"),ParseError); 239 188 CPPUNIT_ASSERT_THROW(Formula formula(" "),ParseError); … … 243 192 CPPUNIT_ASSERT_THROW(Formula formula("1NaCl"),ParseError); 244 193 CPPUNIT_ASSERT_THROW(Formula formula("Mag"),ParseError); 245 CPPUNIT_ASSERT_THROW(Formula formula("AgCl)"),ParseError);246 CPPUNIT_ASSERT_THROW(Formula formula("(Na"),ParseError);247 CPPUNIT_ASSERT_THROW(Formula formula("(Mag)"),ParseError);248 CPPUNIT_ASSERT_THROW(Formula formula("MgCl2)"),ParseError);249 CPPUNIT_ASSERT_THROW(Formula formula("((MgCl2)"),ParseError);250 CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2))"),ParseError);251 CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2]"),ParseError);252 CPPUNIT_ASSERT_THROW(Formula formula("[MgCl2)"),ParseError);253 CPPUNIT_ASSERT_THROW(Formula formula("N(aCl"),ParseError);254 CPPUNIT_ASSERT_THROW(Formula formula("Na()Cl"),ParseError);255 194 } 256 195 -
src/unittests/Makefile.am
rd223d5 r255971 64 64 UILIBS = ../UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la 65 65 66 66 67 TESTSOURCES = \ 67 68 ActOnAllUnitTest.cpp \ -
src/unittests/ShapeUnittest.cpp
rd223d5 r255971 16 16 #endif /*HAVE_TESTRUNNER*/ 17 17 18 #include "Shapes/Shape.hpp" 18 19 #include "LinearAlgebra/Vector.hpp" 19 #include "Shapes/Shape.hpp"20 20 21 21 // Registers the fixture into the 'registry' -
test_all.sh
rd223d5 r255971 111 111 echo "Making"; 112 112 if [ $noprocs -gt 1 ]; then 113 make -j$noprocs all >>$logfile 2>&1;114 else 115 make all >>$logfile 2>&1;113 make -j$noprocs all install >>$logfile 2>&1; 114 else 115 make all install >>$logfile 2>&1; 116 116 fi 117 117 } -
tests/Tesselations/Makefile.am
rd223d5 r255971 1 TESTS = \ 2 1_2-dimethoxyethane.test \ 3 1_2-dimethylbenzene.test \ 4 2-methylcyclohexanone.test \ 5 benzene.test \ 6 cholesterol.test \ 7 cycloheptane.test \ 8 dimethyl_bromomalonate.test \ 9 glucose.test \ 10 isoleucine.test \ 11 neohexane.test \ 12 N_N-dimethylacetamide.test \ 13 proline.test \ 14 putrescine.test \ 15 tartaric_acid.test 16 17 # heptan.test 1 TESTS = 1_2-dimethoxyethane.test \ 2 1_2-dimethylbenzene.test \ 3 2-methylcyclohexanone.test \ 4 benzene.test \ 5 cholesterol.test \ 6 cycloheptane.test \ 7 dimethyl_bromomalonate.test \ 8 glucose.test \ 9 heptan.test \ 10 isoleucine.test \ 11 neohexane.test \ 12 N_N-dimethylacetamide.test \ 13 proline.test \ 14 putrescine.test \ 15 tartaric_acid.test
Note:
See TracChangeset
for help on using the changeset viewer.
