From cce8391e441828cf0d74dc76d2fb8c4acf5a7b44 Mon Sep 17 00:00:00 2001 From: PBerger Date: Sun, 16 Dec 2012 18:17:40 +0100 Subject: [PATCH] Refactored everything to match naming scheme. --- src/exceptions/FileIoException.h | 33 ++++++++++++++++ ..._argument.h => InvalidArgumentException.h} | 18 ++++----- ...nvalid_state.h => InvalidStateException.h} | 18 ++++----- .../{out_of_range.h => OutOfRangeException.h} | 18 ++++----- src/exceptions/WrongFileFormatException.h | 35 +++++++++++++++++ src/exceptions/file_IO_exception.h | 33 ---------------- src/exceptions/wrong_file_format.h | 35 ----------------- src/formula/ProbabilisticIntervalOperator.h | 2 +- src/modelChecker/EigenDtmcPrctlModelChecker.h | 4 +- src/modelChecker/GmmxxDtmcPrctlModelChecker.h | 4 +- src/models/AtomicPropositionsLabeling.h | 13 ++++--- src/mrmc.cpp | 4 +- src/parser/parser.cpp | 22 +++++------ src/parser/parser.h | 6 +-- src/parser/readLabFile.cpp | 8 ++-- src/parser/readTraFile.cpp | 8 ++-- src/solver/GraphAnalyzer.h | 10 ++--- src/storage/BitVector.h | 14 +++---- src/storage/SquareSparseMatrix.h | 38 +++++++++---------- .../{const_templates.h => ConstTemplates.h} | 8 ++-- src/utility/{ioUtility.cpp => IoUtility.cpp} | 4 +- src/utility/{ioUtility.h => IoUtility.h} | 8 ++-- src/utility/{osDetection.h => OsDetection.h} | 0 src/utility/{settings.cpp => Settings.cpp} | 4 +- src/utility/{settings.h => Settings.h} | 8 ++-- src/utility/{vector.h => Vector.h} | 8 ++-- test/eigen/sparse_matrix_test.cpp | 2 +- test/parser/parse_dtmc_test.cpp | 2 +- test/parser/read_lab_file_test.cpp | 12 +++--- test/parser/read_tra_file_test.cpp | 14 +++---- test/reward/reward_model_test.cpp | 2 +- test/storage/BitVectorTest.cpp | 2 +- test/storage/SquareSparseMatrixTest.cpp | 17 +++++---- 33 files changed, 209 insertions(+), 205 deletions(-) create mode 100644 src/exceptions/FileIoException.h rename src/exceptions/{invalid_argument.h => InvalidArgumentException.h} (51%) rename src/exceptions/{invalid_state.h => InvalidStateException.h} (52%) rename src/exceptions/{out_of_range.h => OutOfRangeException.h} (54%) create mode 100644 src/exceptions/WrongFileFormatException.h delete mode 100644 src/exceptions/file_IO_exception.h delete mode 100644 src/exceptions/wrong_file_format.h rename src/utility/{const_templates.h => ConstTemplates.h} (94%) rename src/utility/{ioUtility.cpp => IoUtility.cpp} (97%) rename src/utility/{ioUtility.h => IoUtility.h} (90%) rename src/utility/{osDetection.h => OsDetection.h} (100%) rename src/utility/{settings.cpp => Settings.cpp} (99%) rename src/utility/{settings.h => Settings.h} (98%) rename src/utility/{vector.h => Vector.h} (88%) diff --git a/src/exceptions/FileIoException.h b/src/exceptions/FileIoException.h new file mode 100644 index 000000000..5fd72dad9 --- /dev/null +++ b/src/exceptions/FileIoException.h @@ -0,0 +1,33 @@ +/* + * FileIoException.h + * + * Created on: 16.08.2012 + * Author: Thomas Heinemann + */ + +#ifndef MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ +#define MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ + +namespace mrmc { + +namespace exceptions { + +class FileIoException : public std::exception { + public: +#ifdef _WIN32 + FileIoException() : exception("::mrmc::FileIoException"){}; + FileIoException(const char * const s): exception(s) {}; +#else + FileIoException() {}; + FileIoException(const char * const s): exception() {}; +#endif + virtual const char* what() const throw(){ + { return "mrmc::FileIoException"; } + } +}; + +} + +} + +#endif /* MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ */ diff --git a/src/exceptions/invalid_argument.h b/src/exceptions/InvalidArgumentException.h similarity index 51% rename from src/exceptions/invalid_argument.h rename to src/exceptions/InvalidArgumentException.h index 31db957a4..051e4c000 100644 --- a/src/exceptions/invalid_argument.h +++ b/src/exceptions/InvalidArgumentException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_INVALID_ARGUMENT_H_ -#define MRMC_EXCEPTIONS_INVALID_ARGUMENT_H_ +#ifndef MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ +#define MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ #include @@ -8,7 +8,7 @@ namespace mrmc { namespace exceptions { //!This exception is thrown when a parameter is invalid in this context -class invalid_argument : public std::exception +class InvalidArgumentException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -18,17 +18,17 @@ class invalid_argument : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - invalid_argument() : exception("::mrmc::invalid_argument"){} - invalid_argument(const char * const s): exception(s) {} + InvalidArgumentException() : exception("::mrmc::InvalidArgumentException"){} + InvalidArgumentException(const char * const s): exception(s) {} #else - invalid_argument() : exception() {} - invalid_argument(const char * const s): exception() {} + InvalidArgumentException() : exception() {} + InvalidArgumentException(const char * const s): exception() {} #endif virtual const char* what() const throw() - { return "mrmc::invalid_argument"; } + { return "mrmc::InvalidArgumentException"; } }; } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_INVALID_ARGUMENT_H_ +#endif // MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ diff --git a/src/exceptions/invalid_state.h b/src/exceptions/InvalidStateException.h similarity index 52% rename from src/exceptions/invalid_state.h rename to src/exceptions/InvalidStateException.h index 132c99644..32b07a659 100644 --- a/src/exceptions/invalid_state.h +++ b/src/exceptions/InvalidStateException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_INVALID_STATE_H_ -#define MRMC_EXCEPTIONS_INVALID_STATE_H_ +#ifndef MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ +#define MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ #include @@ -9,7 +9,7 @@ namespace exceptions { //!This exception is thrown when a memory request can't be //!fulfilled. -class invalid_state : public std::exception +class InvalidStateException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -19,19 +19,19 @@ class invalid_state : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - invalid_state() : exception("::mrmc::invalid_state"){} - invalid_state(const char * const s): exception(s) {} + InvalidStateException() : exception("::mrmc::InvalidStateException"){} + InvalidStateException(const char * const s): exception(s) {} #else - invalid_state() : exception() {} - invalid_state(const char * const s): exception() {} + InvalidStateException() : exception() {} + InvalidStateException(const char * const s): exception() {} #endif virtual const char* what() const throw() - { return "mrmc::invalid_state"; } + { return "mrmc::InvalidStateException"; } }; } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_INVALID_STATE_H_ +#endif // MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ diff --git a/src/exceptions/out_of_range.h b/src/exceptions/OutOfRangeException.h similarity index 54% rename from src/exceptions/out_of_range.h rename to src/exceptions/OutOfRangeException.h index 5b1bfaac9..dffcd4e78 100644 --- a/src/exceptions/out_of_range.h +++ b/src/exceptions/OutOfRangeException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_OUT_OF_RANGE_H_ -#define MRMC_EXCEPTIONS_OUT_OF_RANGE_H_ +#ifndef MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ +#define MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ #include @@ -8,7 +8,7 @@ namespace mrmc { namespace exceptions { //!This exception is thrown when a parameter is not in the range of valid values -class out_of_range : public std::exception +class OutOfRangeException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -18,17 +18,17 @@ class out_of_range : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - out_of_range() : exception("::mrmc::out_of_range"){} - out_of_range(const char * const s): exception(s) {} + OutOfRangeException() : exception("::mrmc::OutOfRangeException"){} + OutOfRangeException(const char * const s): exception(s) {} #else - out_of_range() : exception() {} - out_of_range(const char * const s): exception() {} + OutOfRangeException() : exception() {} + OutOfRangeException(const char * const s): exception() {} #endif virtual const char* what() const throw() - { return "mrmc::out_of_range"; } + { return "mrmc::OutOfRangeException"; } }; } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_OUT_OF_RANGE_H_ +#endif // MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ diff --git a/src/exceptions/WrongFileFormatException.h b/src/exceptions/WrongFileFormatException.h new file mode 100644 index 000000000..11dafe38b --- /dev/null +++ b/src/exceptions/WrongFileFormatException.h @@ -0,0 +1,35 @@ +/* + * WrongFileFormatException.h + * + * Created on: 16.08.2012 + * Author: Thomas Heinemann + */ + +#ifndef MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ +#define MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ + +#include + +namespace mrmc { + +namespace exceptions { + +class WrongFileFormatException : public std::exception { + public: +#ifdef _WIN32 + WrongFileFormatException() : exception("::mrmc::WrongFileFormatException"){}; + WrongFileFormatException(const char * const s): exception(s) {}; +#else + WrongFileFormatException() {}; + WrongFileFormatException(const char * const s): exception() {}; +#endif + virtual const char* what() const throw(){ + { return "mrmc::WrongFileFormatException"; } + } +}; + +} //namespace exceptions + +} //namespace mrmc + +#endif /* MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ */ diff --git a/src/exceptions/file_IO_exception.h b/src/exceptions/file_IO_exception.h deleted file mode 100644 index b2270fbe2..000000000 --- a/src/exceptions/file_IO_exception.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * file_IO_exception.h - * - * Created on: 16.08.2012 - * Author: Thomas Heinemann - */ - -#ifndef MRMC_EXCEPTIONS_FILE_IO_EXCEPTION_H_ -#define MRMC_EXCEPTIONS_FILE_IO_EXCEPTION_H_ - -namespace mrmc { - -namespace exceptions { - -class file_IO_exception : public std::exception { - public: -#ifdef _WIN32 - file_IO_exception() : exception("::mrmc::file_IO_exception"){}; - file_IO_exception(const char * const s): exception(s) {}; -#else - file_IO_exception() {}; - file_IO_exception(const char * const s): exception() {}; -#endif - virtual const char* what() const throw(){ - { return "mrmc::file_IO_exception"; } - } -}; - -} - -} - -#endif /* MRMC_EXCEPTIONS_FILE_IO_EXCEPTION_H_ */ diff --git a/src/exceptions/wrong_file_format.h b/src/exceptions/wrong_file_format.h deleted file mode 100644 index afe996733..000000000 --- a/src/exceptions/wrong_file_format.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * wrong_file_format.h - * - * Created on: 16.08.2012 - * Author: Thomas Heinemann - */ - -#ifndef WRONG_FILE_FORMAT_H_ -#define WRONG_FILE_FORMAT_H_ - -#include - -namespace mrmc { - -namespace exceptions { - -class wrong_file_format : public std::exception { - public: -#ifdef _WIN32 - wrong_file_format() : exception("::mrmc::wrong_file_format"){}; - wrong_file_format(const char * const s): exception(s) {}; -#else - wrong_file_format() {}; - wrong_file_format(const char * const s): exception() {}; -#endif - virtual const char* what() const throw(){ - { return "mrmc::wrong_file_format"; } - } -}; - -} //namespace exceptions - -} //namespace mrmc - -#endif /* WRONG_FILE_FORMAT_H_ */ diff --git a/src/formula/ProbabilisticIntervalOperator.h b/src/formula/ProbabilisticIntervalOperator.h index c7ffb9ba3..8bd86d393 100644 --- a/src/formula/ProbabilisticIntervalOperator.h +++ b/src/formula/ProbabilisticIntervalOperator.h @@ -10,7 +10,7 @@ #include "PCTLStateFormula.h" #include "PCTLPathFormula.h" -#include "utility/const_templates.h" +#include "utility/ConstTemplates.h" namespace mrmc { diff --git a/src/modelChecker/EigenDtmcPrctlModelChecker.h b/src/modelChecker/EigenDtmcPrctlModelChecker.h index 4730ab9cc..084c576f4 100644 --- a/src/modelChecker/EigenDtmcPrctlModelChecker.h +++ b/src/modelChecker/EigenDtmcPrctlModelChecker.h @@ -8,12 +8,12 @@ #ifndef EIGENDTMCPRCTLMODELCHECKER_H_ #define EIGENDTMCPRCTLMODELCHECKER_H_ -#include "src/utility/vector.h" +#include "src/utility/Vector.h" #include "src/models/Dtmc.h" #include "src/modelChecker/DtmcPrctlModelChecker.h" #include "src/solver/GraphAnalyzer.h" -#include "src/utility/const_templates.h" +#include "src/utility/ConstTemplates.h" #include "src/exceptions/NoConvergence.h" #include "Eigen/Sparse" diff --git a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h index 8d2af9f2a..a3b1a57c4 100644 --- a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h +++ b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h @@ -13,9 +13,9 @@ #include "src/models/Dtmc.h" #include "src/modelChecker/DtmcPrctlModelChecker.h" #include "src/solver/GraphAnalyzer.h" -#include "src/utility/vector.h" +#include "src/utility/Vector.h" -#include "src/utility/settings.h" +#include "src/utility/Settings.h" #include "gmm/gmm_matrix.h" #include "gmm/gmm_iter_solvers.h" diff --git a/src/models/AtomicPropositionsLabeling.h b/src/models/AtomicPropositionsLabeling.h index 34c2da73b..a35fd693a 100644 --- a/src/models/AtomicPropositionsLabeling.h +++ b/src/models/AtomicPropositionsLabeling.h @@ -9,6 +9,7 @@ #define MRMC_MODELS_ATOMIC_PROPOSITIONS_LABELING_H_ #include "src/storage/BitVector.h" +#include "src/exceptions/OutOfRangeException.h" #include #include #include @@ -81,10 +82,10 @@ public: */ uint_fast64_t addAtomicProposition(std::string ap) { if (nameToLabelingMap.count(ap) != 0) { - throw std::out_of_range("Atomic Proposition already exists."); + throw mrmc::exceptions::OutOfRangeException("Atomic Proposition already exists."); } if (apsCurrent >= apCountMax) { - throw std::out_of_range("Added more atomic propositions than" + throw mrmc::exceptions::OutOfRangeException("Added more atomic propositions than" "previously declared."); } nameToLabelingMap[ap] = apsCurrent; @@ -109,10 +110,12 @@ public: */ void addAtomicPropositionToState(std::string ap, const uint_fast64_t state) { if (nameToLabelingMap.count(ap) == 0) { - throw std::out_of_range("Atomic Proposition '" + ap + "' unknown."); + /*throw mrmc::exceptions::OutOfRangeException("Atomic Proposition '" << ap << "' unknown.");*/ + // TODO !!! + throw mrmc::exceptions::OutOfRangeException("Atomic Proposition '' unknown."); } if (state >= stateCount) { - throw std::out_of_range("State index out of range."); + throw mrmc::exceptions::OutOfRangeException("State index out of range."); } this->singleLabelings[nameToLabelingMap[ap]]->set(state, true); } @@ -124,7 +127,7 @@ public: */ std::set getPropositionsForState(uint_fast64_t state) { if (state >= stateCount) { - throw std::out_of_range("State index out of range."); + throw mrmc::exceptions::OutOfRangeException("State index out of range."); } std::set result; for (auto it = nameToLabelingMap.begin(); diff --git a/src/mrmc.cpp b/src/mrmc.cpp index 7d334408c..882c096a8 100644 --- a/src/mrmc.cpp +++ b/src/mrmc.cpp @@ -12,7 +12,7 @@ * Description: Central part of the application containing the main() Method */ -#include "src/utility/osDetection.h" +#include "src/utility/OsDetection.h" #include #include #include @@ -28,7 +28,7 @@ #include "src/parser/readTraFile.h" #include "src/parser/readPrctlFile.h" #include "src/solver/GraphAnalyzer.h" -#include "src/utility/settings.h" +#include "src/utility/Settings.h" #include "src/formula/Formulas.h" #include "src/exceptions/NoConvergence.h" diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index 9e5558291..010ed201a 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -12,8 +12,8 @@ #include #include -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" @@ -22,7 +22,7 @@ extern log4cplus::Logger logger; /*! * Calls strtol() internally and checks if the new pointer is different * from the original one, i.e. if str != *end. If they are the same, a - * mrmc::exceptions::wrong_file_format will be thrown. + * mrmc::exceptions::WrongFileFormatException will be thrown. * @param str String to parse * @param end New pointer will be written there * @return Result of strtol() @@ -34,7 +34,7 @@ uint_fast64_t mrmc::parser::Parser::checked_strtol(const char* str, char** end) { LOG4CPLUS_ERROR(logger, "Error while parsing integer. Next input token is not a number."); LOG4CPLUS_ERROR(logger, "\tUpcoming input is: \"" << std::string(str, 0, 16) << "\""); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException("Error while parsing integer. Next input token is not a number."); } return res; } @@ -71,14 +71,14 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) #endif { LOG4CPLUS_ERROR(logger, "Error in stat(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in stat()"); } this->file = open(filename, O_RDONLY); if (this->file < 0) { LOG4CPLUS_ERROR(logger, "Error in open(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in open()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in open()"); } this->data = (char*) mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0); @@ -86,7 +86,7 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) { close(this->file); LOG4CPLUS_ERROR(logger, "Error in mmap(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in mmap()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in mmap()"); } this->dataend = this->data + this->st.st_size; #elif defined WINDOWS @@ -97,14 +97,14 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) if (_stat64(filename, &(this->st)) != 0) { LOG4CPLUS_ERROR(logger, "Error in _stat(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in stat()"); } this->file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (this->file == INVALID_HANDLE_VALUE) { LOG4CPLUS_ERROR(logger, "Error in CreateFileA(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFileA()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in CreateFileA()"); } this->mapping = CreateFileMappingA(this->file, NULL, PAGE_READONLY, (DWORD)(st.st_size >> 32), (DWORD)st.st_size, NULL); @@ -112,7 +112,7 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) { CloseHandle(this->file); LOG4CPLUS_ERROR(logger, "Error in CreateFileMappingA(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFileMappingA()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in CreateFileMappingA()"); } this->data = static_cast(MapViewOfFile(this->mapping, FILE_MAP_READ, 0, 0, this->st.st_size)); @@ -121,7 +121,7 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) CloseHandle(this->mapping); CloseHandle(this->file); LOG4CPLUS_ERROR(logger, "Error in MapViewOfFile(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in MapViewOfFile()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in MapViewOfFile()"); } this->dataend = this->data + this->st.st_size; #endif diff --git a/src/parser/parser.h b/src/parser/parser.h index 78b8dd890..a21cdf1d5 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -8,7 +8,7 @@ #ifndef PARSER_H_ #define PARSER_H_ -#include "src/utility/osDetection.h" +#include "src/utility/OsDetection.h" #if defined LINUX || defined MACOSX # include @@ -23,8 +23,8 @@ #include #include -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" namespace mrmc { diff --git a/src/parser/readLabFile.cpp b/src/parser/readLabFile.cpp index 3ef488373..6301f86c3 100644 --- a/src/parser/readLabFile.cpp +++ b/src/parser/readLabFile.cpp @@ -9,8 +9,8 @@ #include "readLabFile.h" -#include "src/exceptions/wrong_file_format.h" -#include "src/exceptions/file_IO_exception.h" +#include "src/exceptions/WrongFileFormatException.h" +#include "src/exceptions/FileIoException.h" #include #include @@ -103,7 +103,7 @@ LabParser::LabParser(uint_fast64_t node_count, const char * filename) LOG4CPLUS_ERROR(logger, "Wrong file format in (" << filename << "). File header is corrupted."); if (! foundDecl) LOG4CPLUS_ERROR(logger, "\tDid not find #DECLARATION token."); if (! foundEnd) LOG4CPLUS_ERROR(logger, "\tDid not find #END token."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } } @@ -135,7 +135,7 @@ LabParser::LabParser(uint_fast64_t node_count, const char * filename) * if token is longer than our buffer, the following strncpy code might get risky... */ LOG4CPLUS_ERROR(logger, "Wrong file format in (" << filename << "). Atomic proposition with length > " << (sizeof(proposition)-1) << " was found."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } else if (cnt > 0) { diff --git a/src/parser/readTraFile.cpp b/src/parser/readTraFile.cpp index 902259f54..e7a1d7cb2 100644 --- a/src/parser/readTraFile.cpp +++ b/src/parser/readTraFile.cpp @@ -8,8 +8,8 @@ #include "parser.h" #include "src/parser/readTraFile.h" -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" #include "boost/integer/integer_mask.hpp" #include #include @@ -142,7 +142,7 @@ TraParser::TraParser(const char * filename) if (non_zero == 0) { LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": erroneous file format."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } /* @@ -195,7 +195,7 @@ TraParser::TraParser(const char * filename) if ((val <= 0.0) || (val > 1.0)) { LOG4CPLUS_ERROR(logger, "Found transition probability of " << val << ", but we think probabilities should be from (0,1]."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } this->matrix->addNextValue(row,col,val); buf = skipWS(buf); diff --git a/src/solver/GraphAnalyzer.h b/src/solver/GraphAnalyzer.h index 34864520e..e1f062798 100644 --- a/src/solver/GraphAnalyzer.h +++ b/src/solver/GraphAnalyzer.h @@ -9,7 +9,7 @@ #define GRAPHANALYZER_H_ #include "src/models/Dtmc.h" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" @@ -38,7 +38,7 @@ public: // Check for valid parameter. if (existsPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'existsPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'existsPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'existsPhiUntilPhiStates' must not be null."); } // Get the backwards transition relation from the model to ease the search. @@ -85,7 +85,7 @@ public: // Check for valid parameter. if (alwaysPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'alwaysPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'alwaysPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'alwaysPhiUntilPhiStates' must not be null."); } GraphAnalyzer::getExistsPhiUntilPsiStates(model, ~psiStates, ~existsPhiUntilPsiStates, alwaysPhiUntilPsiStates); @@ -109,11 +109,11 @@ public: // Check for valid parameters. if (existsPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'existsPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'existsPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'existsPhiUntilPhiStates' must not be null."); } if (alwaysPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'alwaysPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'alwaysPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'alwaysPhiUntilPhiStates' must not be null."); } // Perform search. diff --git a/src/storage/BitVector.h b/src/storage/BitVector.h index a7c063eb4..7610a85a1 100644 --- a/src/storage/BitVector.h +++ b/src/storage/BitVector.h @@ -6,11 +6,11 @@ #include #include "boost/integer/integer_mask.hpp" -#include "src/exceptions/invalid_state.h" -#include "src/exceptions/invalid_argument.h" -#include "src/exceptions/out_of_range.h" +#include "src/exceptions/InvalidStateException.h" +#include "src/exceptions/InvalidArgumentException.h" +#include "src/exceptions/OutOfRangeException.h" -#include "src/utility/osDetection.h" +#include "src/utility/OsDetection.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" @@ -102,7 +102,7 @@ public: // Check whether the given length is valid. if (length == 0) { LOG4CPLUS_ERROR(logger, "Trying to create bit vector of size 0."); - throw mrmc::exceptions::invalid_argument("Trying to create a bit vector of size 0."); + throw mrmc::exceptions::InvalidArgumentException("Trying to create a bit vector of size 0."); } // Compute the correct number of buckets needed to store the given number of bits @@ -205,7 +205,7 @@ public: */ void set(const uint_fast64_t index, const bool value) { uint_fast64_t bucket = index >> 6; - if (bucket >= this->bucketCount) throw mrmc::exceptions::out_of_range(); + if (bucket >= this->bucketCount) throw mrmc::exceptions::OutOfRangeException(); uint_fast64_t mask = static_cast(1) << (index & mod64mask); if (value) { this->bucketArray[bucket] |= mask; @@ -223,7 +223,7 @@ public: */ bool get(const uint_fast64_t index) const { uint_fast64_t bucket = index >> 6; - if (bucket >= this->bucketCount) throw mrmc::exceptions::out_of_range(); + if (bucket >= this->bucketCount) throw mrmc::exceptions::OutOfRangeException(); uint_fast64_t mask = static_cast(1) << (index & mod64mask); return ((this->bucketArray[bucket] & mask) == mask); } diff --git a/src/storage/SquareSparseMatrix.h b/src/storage/SquareSparseMatrix.h index 4fe87daed..9fb363d42 100644 --- a/src/storage/SquareSparseMatrix.h +++ b/src/storage/SquareSparseMatrix.h @@ -7,14 +7,14 @@ #include #include "boost/integer/integer_mask.hpp" -#include "src/exceptions/invalid_state.h" -#include "src/exceptions/invalid_argument.h" -#include "src/exceptions/out_of_range.h" -#include "src/exceptions/file_IO_exception.h" +#include "src/exceptions/InvalidStateException.h" +#include "src/exceptions/InvalidArgumentException.h" +#include "src/exceptions/OutOfRangeException.h" +#include "src/exceptions/FileIoException.h" #include "src/storage/BitVector.h" #include "src/storage/JacobiDecomposition.h" -#include "src/utility/const_templates.h" +#include "src/utility/ConstTemplates.h" #include "Eigen/Sparse" #include "gmm/gmm_matrix.h" @@ -78,7 +78,7 @@ public: // Check whether copying the matrix is safe. if (!ssm.hasError()) { LOG4CPLUS_ERROR(logger, "Trying to copy sparse matrix in error state."); - throw mrmc::exceptions::invalid_argument("Trying to copy sparse matrix in error state."); + throw mrmc::exceptions::InvalidArgumentException("Trying to copy sparse matrix in error state."); } else { // Try to prepare the internal storage and throw an error in case // of a failure. @@ -142,15 +142,15 @@ public: if (internalStatus != MatrixStatus::UnInitialized) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to initialize matrix that is not uninitialized."); - throw mrmc::exceptions::invalid_state("Trying to initialize matrix that is not uninitialized."); + throw mrmc::exceptions::InvalidStateException("Trying to initialize matrix that is not uninitialized."); } else if (rowCount == 0) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to create initialize a matrix with 0 rows."); - throw mrmc::exceptions::invalid_argument("Trying to create initialize a matrix with 0 rows."); + throw mrmc::exceptions::InvalidArgumentException("Trying to create initialize a matrix with 0 rows."); } else if (((rowCount * rowCount) - rowCount) < nonZeroEntries) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to initialize a matrix with more non-zero entries than there can be."); - throw mrmc::exceptions::invalid_argument("Trying to initialize a matrix with more non-zero entries than there can be."); + throw mrmc::exceptions::InvalidArgumentException("Trying to initialize a matrix with more non-zero entries than there can be."); } else { // If it is safe, initialize necessary members and prepare the // internal storage. @@ -181,7 +181,7 @@ public: if (!eigenSparseMatrix.isCompressed()) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to initialize from an Eigen matrix that is not in compressed form."); - throw mrmc::exceptions::invalid_argument("Trying to initialize from an Eigen matrix that is not in compressed form."); + throw mrmc::exceptions::InvalidArgumentException("Trying to initialize from an Eigen matrix that is not in compressed form."); } // Compute the actual (i.e. non-diagonal) number of non-zero entries. @@ -274,7 +274,7 @@ public: if ((row > rowCount) || (col > rowCount)) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to add a value at illegal position (" << row << ", " << col << ")."); - throw mrmc::exceptions::out_of_range("Trying to add a value at illegal position."); + throw mrmc::exceptions::OutOfRangeException("Trying to add a value at illegal position."); } if (row == col) { // Set a diagonal element. @@ -307,11 +307,11 @@ public: if (!isInitialized()) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to finalize an uninitialized matrix."); - throw mrmc::exceptions::invalid_state("Trying to finalize an uninitialized matrix."); + throw mrmc::exceptions::InvalidStateException("Trying to finalize an uninitialized matrix."); } else if (currentSize != nonZeroEntryCount) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to finalize a matrix that was initialized with more non-zero entries than given."); - throw mrmc::exceptions::invalid_state("Trying to finalize a matrix that was initialized with more non-zero entries than given."); + throw mrmc::exceptions::InvalidStateException("Trying to finalize a matrix that was initialized with more non-zero entries than given."); } else { // Fill in the missing entries in the row_indications array. // (Can happen because of empty rows at the end.) @@ -345,7 +345,7 @@ public: // Check for illegal access indices. if ((row > rowCount) || (col > rowCount)) { LOG4CPLUS_ERROR(logger, "Trying to read a value from illegal position (" << row << ", " << col << ")."); - throw mrmc::exceptions::out_of_range("Trying to read a value from illegal position."); + throw mrmc::exceptions::OutOfRangeException("Trying to read a value from illegal position."); return false; } @@ -395,7 +395,7 @@ public: // Check for illegal access indices. if ((row > rowCount) || (col > rowCount)) { LOG4CPLUS_ERROR(logger, "Trying to read a value from illegal position (" << row << ", " << col << ")."); - throw mrmc::exceptions::out_of_range("Trying to read a value from illegal position."); + throw mrmc::exceptions::OutOfRangeException("Trying to read a value from illegal position."); return false; } @@ -423,7 +423,7 @@ public: ++rowStart; } - throw mrmc::exceptions::invalid_argument("Trying to get a reference to a non-existant value."); + throw mrmc::exceptions::InvalidArgumentException("Trying to get a reference to a non-existant value."); } /*! @@ -515,7 +515,7 @@ public: if (!isReadReady()) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to convert a matrix that is not in a readable state to an Eigen matrix."); - throw mrmc::exceptions::invalid_state("Trying to convert a matrix that is not in a readable state to an Eigen matrix."); + throw mrmc::exceptions::InvalidStateException("Trying to convert a matrix that is not in a readable state to an Eigen matrix."); } else { // Create the resulting matrix. int_fast32_t eigenRows = static_cast(rowCount); @@ -733,7 +733,7 @@ public: // Check whether the accessed state exists. if (row > rowCount) { LOG4CPLUS_ERROR(logger, "Trying to make an illegal row " << row << " absorbing."); - throw mrmc::exceptions::out_of_range("Trying to make an illegal row absorbing."); + throw mrmc::exceptions::OutOfRangeException("Trying to make an illegal row absorbing."); return false; } @@ -797,7 +797,7 @@ public: // Check for valid constraint. if (constraint.getNumberOfSetBits() == 0) { LOG4CPLUS_ERROR(logger, "Trying to create a sub-matrix of size 0."); - throw mrmc::exceptions::invalid_argument("Trying to create a sub-matrix of size 0."); + throw mrmc::exceptions::InvalidArgumentException("Trying to create a sub-matrix of size 0."); } // First, we need to determine the number of non-zero entries of the diff --git a/src/utility/const_templates.h b/src/utility/ConstTemplates.h similarity index 94% rename from src/utility/const_templates.h rename to src/utility/ConstTemplates.h index ea2231cba..8a4abef6a 100644 --- a/src/utility/const_templates.h +++ b/src/utility/ConstTemplates.h @@ -1,12 +1,12 @@ /* - * const_templates.h + * ConstTemplates.h * * Created on: 11.10.2012 * Author: Thomas Heinemann */ -#ifndef CONST_TEMPLATES_H_ -#define CONST_TEMPLATES_H_ +#ifndef MRMC_UTILITY_CONSTTEMPLATES_H_ +#define MRMC_UTILITY_CONSTTEMPLATES_H_ namespace mrmc { @@ -93,4 +93,4 @@ inline double constGetOne(double&) { } //namespace mrmc -#endif /* CONST_TEMPLATES_H_ */ +#endif /* MRMC_UTILITY_CONSTTEMPLATES_H_ */ diff --git a/src/utility/ioUtility.cpp b/src/utility/IoUtility.cpp similarity index 97% rename from src/utility/ioUtility.cpp rename to src/utility/IoUtility.cpp index 01872a3c9..2beddb5cd 100644 --- a/src/utility/ioUtility.cpp +++ b/src/utility/IoUtility.cpp @@ -1,11 +1,11 @@ /* - * ioUtility.cpp + * IoUtility.cpp * * Created on: 17.10.2012 * Author: Thomas Heinemann */ -#include "src/utility/ioUtility.h" +#include "src/utility/IoUtility.h" #include "src/parser/readTraFile.h" #include "src/parser/readLabFile.h" diff --git a/src/utility/ioUtility.h b/src/utility/IoUtility.h similarity index 90% rename from src/utility/ioUtility.h rename to src/utility/IoUtility.h index 04a389a1d..5b691d9b2 100644 --- a/src/utility/ioUtility.h +++ b/src/utility/IoUtility.h @@ -1,12 +1,12 @@ /* - * ioUtility.h + * IoUtility.h * * Created on: 17.10.2012 * Author: Thomas Heinemann */ -#ifndef UTILITY_H_ -#define UTILITY_H_ +#ifndef MRMC_UTILITY_IOUTILITY_H_ +#define MRMC_UTILITY_IOUTILITY_H_ #include "src/models/Dtmc.h" @@ -42,4 +42,4 @@ mrmc::models::Dtmc* parseDTMC(const char* tra_file, const char* lab_file } //namespace mrmc -#endif /* UTILITY_H_ */ +#endif /* MRMC_UTILITY_IOUTILITY_H_ */ diff --git a/src/utility/osDetection.h b/src/utility/OsDetection.h similarity index 100% rename from src/utility/osDetection.h rename to src/utility/OsDetection.h diff --git a/src/utility/settings.cpp b/src/utility/Settings.cpp similarity index 99% rename from src/utility/settings.cpp rename to src/utility/Settings.cpp index e22e72eaa..62a56d4b7 100644 --- a/src/utility/settings.cpp +++ b/src/utility/Settings.cpp @@ -1,11 +1,11 @@ /* - * settings.cpp + * Settings.cpp * * Created on: 22.11.2012 * Author: Gereon Kremer */ -#include "src/utility/settings.h" +#include "src/utility/Settings.h" #include "src/exceptions/BaseException.h" diff --git a/src/utility/settings.h b/src/utility/Settings.h similarity index 98% rename from src/utility/settings.h rename to src/utility/Settings.h index d7387392d..931842006 100644 --- a/src/utility/settings.h +++ b/src/utility/Settings.h @@ -1,12 +1,12 @@ /* - * settings.h + * Settings.h * * Created on: 22.11.2012 * Author: Gereon Kremer */ -#ifndef SETTINGS_H_ -#define SETTINGS_H_ +#ifndef MRMC_SETTINGS_SETTINGS_H_ +#define MRMC_SETTINGS_SETTINGS_H_ #include #include @@ -212,4 +212,4 @@ namespace settings { } // namespace settings } // namespace mrmc -#endif // SETTINGS_H_ +#endif // MRMC_SETTINGS_SETTINGS_H_ diff --git a/src/utility/vector.h b/src/utility/Vector.h similarity index 88% rename from src/utility/vector.h rename to src/utility/Vector.h index d872fc124..d33de256c 100644 --- a/src/utility/vector.h +++ b/src/utility/Vector.h @@ -1,12 +1,12 @@ /* - * vector.h + * Vector.h * * Created on: 06.12.2012 * Author: Christian Dehnert */ -#ifndef VECTOR_H_ -#define VECTOR_H_ +#ifndef MRMC_UTILITY_VECTOR_H_ +#define MRMC_UTILITY_VECTOR_H_ #include "Eigen/src/Core/Matrix.h" @@ -40,4 +40,4 @@ void setVectorValues(Eigen::Matrix* eigenVector, const mrmc: } //namespace mrmc -#endif /* VECTOR_H_ */ +#endif /* MRMC_UTILITY_VECTOR_H_ */ diff --git a/test/eigen/sparse_matrix_test.cpp b/test/eigen/sparse_matrix_test.cpp index 39f6d274d..67b70f986 100644 --- a/test/eigen/sparse_matrix_test.cpp +++ b/test/eigen/sparse_matrix_test.cpp @@ -1,7 +1,7 @@ #include "gtest/gtest.h" #include "Eigen/Sparse" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" #include "boost/integer/integer_mask.hpp" TEST(EigenSparseMatrixTest, BasicReadWriteTest) { diff --git a/test/parser/parse_dtmc_test.cpp b/test/parser/parse_dtmc_test.cpp index 239ba735f..fc5578509 100644 --- a/test/parser/parse_dtmc_test.cpp +++ b/test/parser/parse_dtmc_test.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "mrmc-config.h" -#include "src/utility/ioUtility.h" +#include "src/utility/IoUtility.h" TEST(ParseDtmcTest, parseAndOutput) { mrmc::models::Dtmc* myDtmc; diff --git a/test/parser/read_lab_file_test.cpp b/test/parser/read_lab_file_test.cpp index 24eb98356..adc5d3a2c 100644 --- a/test/parser/read_lab_file_test.cpp +++ b/test/parser/read_lab_file_test.cpp @@ -9,14 +9,14 @@ #include "mrmc-config.h" #include "src/models/AtomicPropositionsLabeling.h" #include "src/parser/readLabFile.h" -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" #include TEST(ReadLabFileTest, NonExistingFileTest) { //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) - ASSERT_THROW(mrmc::parser::LabParser(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception); + ASSERT_THROW(mrmc::parser::LabParser(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException); } TEST(ReadLabFileTest, ParseTest) { @@ -86,14 +86,14 @@ TEST(ReadLabFileTest, ParseTest) { } TEST(ReadLabFileTest, WrongHeaderTest1) { - ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadLabFileTest, WrongHeaderTest2) { - ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadLabFileTest, WrongPropositionTest) { - ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::WrongFileFormatException); } diff --git a/test/parser/read_tra_file_test.cpp b/test/parser/read_tra_file_test.cpp index 509ea79d8..f8bc8715b 100644 --- a/test/parser/read_tra_file_test.cpp +++ b/test/parser/read_tra_file_test.cpp @@ -9,14 +9,14 @@ #include "mrmc-config.h" #include "src/storage/SquareSparseMatrix.h" #include "src/parser/readTraFile.h" -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" -#include "src/utility/ioUtility.h" +#include "src/utility/IoUtility.h" TEST(ReadTraFileTest, NonExistingFileTest) { //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException); } /* The following test case is based on one of the original MRMC test cases @@ -69,13 +69,13 @@ TEST(ReadTraFileTest, ParseFileTest1) { } TEST(ReadTraFileTest, WrongFormatTestHeader1) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadTraFileTest, WrongFormatTestHeader2) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadTraFileTest, WrongFormatTestTransition) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::WrongFileFormatException); } diff --git a/test/reward/reward_model_test.cpp b/test/reward/reward_model_test.cpp index 58a77fa1c..7cdf52b5e 100644 --- a/test/reward/reward_model_test.cpp +++ b/test/reward/reward_model_test.cpp @@ -1,7 +1,7 @@ #include "gtest/gtest.h" #include "Eigen/Sparse" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" #include "boost/integer/integer_mask.hpp" #include diff --git a/test/storage/BitVectorTest.cpp b/test/storage/BitVectorTest.cpp index a556fb790..02c52c728 100644 --- a/test/storage/BitVectorTest.cpp +++ b/test/storage/BitVectorTest.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" #include "src/storage/BitVector.h" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" TEST(BitVectorTest, GetSetTest) { mrmc::storage::BitVector *bv = NULL; diff --git a/test/storage/SquareSparseMatrixTest.cpp b/test/storage/SquareSparseMatrixTest.cpp index da42aacc4..40648118e 100644 --- a/test/storage/SquareSparseMatrixTest.cpp +++ b/test/storage/SquareSparseMatrixTest.cpp @@ -1,12 +1,13 @@ #include "gtest/gtest.h" #include "src/storage/SquareSparseMatrix.h" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" +#include "src/exceptions/OutOfRangeException.h" TEST(SquareSparseMatrixTest, ZeroRowsTest) { mrmc::storage::SquareSparseMatrix *ssm = new mrmc::storage::SquareSparseMatrix(0); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::UnInitialized); - ASSERT_THROW(ssm->initialize(50), mrmc::exceptions::invalid_argument); + ASSERT_THROW(ssm->initialize(50), mrmc::exceptions::InvalidArgumentException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; @@ -16,7 +17,7 @@ TEST(SquareSparseMatrixTest, TooManyEntriesTest) { mrmc::storage::SquareSparseMatrix *ssm = new mrmc::storage::SquareSparseMatrix(2); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::UnInitialized); - ASSERT_THROW(ssm->initialize(10), mrmc::exceptions::invalid_argument); + ASSERT_THROW(ssm->initialize(10), mrmc::exceptions::InvalidArgumentException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; @@ -29,16 +30,16 @@ TEST(SquareSparseMatrixTest, addNextValueTest) { ASSERT_NO_THROW(ssm->initialize(1)); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Initialized); - ASSERT_THROW(ssm->addNextValue(-1, 1, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(-1, 1, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); - ASSERT_THROW(ssm->addNextValue(1, -1, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(1, -1, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); - ASSERT_THROW(ssm->addNextValue(6, 1, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(6, 1, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); - ASSERT_THROW(ssm->addNextValue(1, 6, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(1, 6, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; @@ -57,7 +58,7 @@ TEST(SquareSparseMatrixTest, finalizeTest) { ASSERT_NO_THROW(ssm->addNextValue(1, 5, 1)); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Initialized); - ASSERT_THROW(ssm->finalize(), mrmc::exceptions::invalid_state); + ASSERT_THROW(ssm->finalize(), mrmc::exceptions::InvalidStateException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm;