Browse Source

Renamed LabParser to AtomicPropositionLabelingParser

tempestpy_adaptions
Lanchid 12 years ago
parent
commit
64784d4e92
  1. 4
      src/mrmc.cpp
  2. 4
      src/parser/AtomicPropositionLabelingParser.cpp
  3. 4
      src/parser/AtomicPropositionLabelingParser.h
  4. 4
      src/utility/IoUtility.cpp
  5. 14
      test/parser/ReadLabFileTest.cpp

4
src/mrmc.cpp

@ -24,7 +24,7 @@
#include "src/models/AtomicPropositionsLabeling.h"
#include "src/modelChecker/EigenDtmcPrctlModelChecker.h"
#include "src/modelChecker/GmmxxDtmcPrctlModelChecker.h"
#include "src/parser/LabParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include "src/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/PrctlParser.h"
#include "src/solver/GraphAnalyzer.h"
@ -102,7 +102,7 @@ int main(const int argc, const char* argv[]) {
}
mrmc::parser::DeterministicSparseTransitionParser traparser(s->getString("trafile"));
mrmc::parser::LabParser labparser(traparser.getMatrix()->getRowCount(), s->getString("labfile").c_str());
mrmc::parser::AtomicPropositionLabelingParser labparser(traparser.getMatrix()->getRowCount(), s->getString("labfile").c_str());
mrmc::models::Dtmc<double> dtmc(traparser.getMatrix(), labparser.getLabeling());
dtmc.printModelInformationToStream(std::cout);

4
src/parser/LabParser.cpp → src/parser/AtomicPropositionLabelingParser.cpp

@ -5,7 +5,7 @@
* Author: Gereon Kremer
*/
#include "src/parser/LabParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include "src/exceptions/WrongFileFormatException.h"
#include "src/exceptions/FileIoException.h"
@ -38,7 +38,7 @@ namespace parser {
* @param filename input .lab file's name.
* @return The pointer to the created labeling object.
*/
LabParser::LabParser(uint_fast64_t node_count, const char * filename)
AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t node_count, const char * filename)
: labeling(nullptr)
{
/*

4
src/parser/LabParser.h → src/parser/AtomicPropositionLabelingParser.h

@ -17,9 +17,9 @@ namespace parser {
* Note that this class creates a new AtomicPropositionsLabeling object that can
* be accessed via getLabeling(). However, it will not delete this object!
*/
class LabParser : Parser {
class AtomicPropositionLabelingParser : Parser {
public:
LabParser(uint_fast64_t node_count, const char* filename);
AtomicPropositionLabelingParser(uint_fast64_t node_count, const char* filename);
std::shared_ptr<mrmc::models::AtomicPropositionsLabeling> getLabeling() {
return this->labeling;

4
src/utility/IoUtility.cpp

@ -7,7 +7,7 @@
#include "src/utility/IoUtility.h"
#include "src/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/LabParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include <fstream>
@ -64,7 +64,7 @@ mrmc::models::Dtmc<double>* parseDTMC(std::string const &tra_file, const char* l
mrmc::parser::DeterministicSparseTransitionParser tp(tra_file);
uint_fast64_t node_count = tp.getMatrix()->getRowCount();
mrmc::parser::LabParser lp(node_count, lab_file);
mrmc::parser::AtomicPropositionLabelingParser lp(node_count, lab_file);
mrmc::models::Dtmc<double>* result = new mrmc::models::Dtmc<double>(tp.getMatrix(), lp.getLabeling());
return result;

14
test/parser/ReadLabFileTest.cpp

@ -8,7 +8,7 @@
#include "gtest/gtest.h"
#include "mrmc-config.h"
#include "src/models/AtomicPropositionsLabeling.h"
#include "src/parser/LabParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFileFormatException.h"
@ -16,16 +16,16 @@
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::FileIoException);
ASSERT_THROW(mrmc::parser::AtomicPropositionLabelingParser(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException);
}
TEST(ReadLabFileTest, ParseTest) {
//This test is based on a test case from the original MRMC.
mrmc::parser::LabParser* parser;
mrmc::parser::AtomicPropositionLabelingParser* parser;
//Parsing the file
ASSERT_NO_THROW(parser = new mrmc::parser::LabParser(12, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/pctl_general_input_01.lab"));
ASSERT_NO_THROW(parser = new mrmc::parser::AtomicPropositionLabelingParser(12, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/pctl_general_input_01.lab"));
std::shared_ptr<mrmc::models::AtomicPropositionsLabeling> labeling(parser->getLabeling());
//Checking whether all propositions are in the labelling
@ -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::WrongFileFormatException);
ASSERT_THROW(mrmc::parser::AtomicPropositionLabelingParser(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::WrongFileFormatException);
ASSERT_THROW(mrmc::parser::AtomicPropositionLabelingParser(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::WrongFileFormatException);
ASSERT_THROW(mrmc::parser::AtomicPropositionLabelingParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::WrongFileFormatException);
}
Loading…
Cancel
Save