Browse Source

changing names of parsers

tempestpy_adaptions
gereon 12 years ago
parent
commit
7eaedbfe9b
  1. 10
      src/mrmc-cpp.cpp
  2. 8
      src/utility/utility.cpp
  3. 12
      test/parser/read_lab_file_test.cpp
  4. 12
      test/parser/read_tra_file_test.cpp

10
src/mrmc-cpp.cpp

@ -26,8 +26,8 @@ PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = "mrmc-cpp"
#include "src/models/dtmc.h" #include "src/models/dtmc.h"
#include "src/sparse/static_sparse_matrix.h" #include "src/sparse/static_sparse_matrix.h"
#include "src/models/atomic_propositions_labeling.h" #include "src/models/atomic_propositions_labeling.h"
#include "src/parser/read_lab_file.h"
#include "src/parser/read_tra_file.h"
#include "src/parser/readLabFile.h"
#include "src/parser/readTraFile.h"
#include "Eigen/Sparse" #include "Eigen/Sparse"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -40,8 +40,10 @@ int main(int argc, char* argv[]) {
exit(-1); exit(-1);
} }
mrmc::sparse::StaticSparseMatrix<double>* probMatrix = mrmc::parser::read_tra_file(argv[1]);
mrmc::models::AtomicPropositionsLabeling* labeling = mrmc::parser::read_lab_file(probMatrix->getRowCount(), argv[2]);
printf("read tra...\n");
mrmc::sparse::StaticSparseMatrix<double>* probMatrix = mrmc::parser::readTraFile(argv[1]);
printf("read lab...\n");
mrmc::models::AtomicPropositionsLabeling* labeling = mrmc::parser::readLabFile(probMatrix->getRowCount(), argv[2]);
mrmc::models::Dtmc<double> dtmc(probMatrix, labeling); mrmc::models::Dtmc<double> dtmc(probMatrix, labeling);
return 0; return 0;

8
src/utility/utility.cpp

@ -6,8 +6,8 @@
*/ */
#include "src/utility/utility.h" #include "src/utility/utility.h"
#include "src/parser/read_tra_file.h"
#include "src/parser/read_lab_file.h"
#include "src/parser/readTraFile.h"
#include "src/parser/readLabFile.h"
#include "src/sparse/static_sparse_matrix.h" #include "src/sparse/static_sparse_matrix.h"
#include "src/models/dtmc.h" #include "src/models/dtmc.h"
@ -79,11 +79,11 @@ void dtmcToDot(mrmc::models::Dtmc<double>* dtmc, const char* filename) {
mrmc::models::Dtmc<double>* parseDTMC(const char* tra_file, const char* lab_file) { mrmc::models::Dtmc<double>* parseDTMC(const char* tra_file, const char* lab_file) {
mrmc::sparse::StaticSparseMatrix<double>* transition_matrix = mrmc::sparse::StaticSparseMatrix<double>* transition_matrix =
mrmc::parser::read_tra_file(tra_file);
mrmc::parser::readTraFile(tra_file);
uint_fast64_t node_count = transition_matrix->getRowCount(); uint_fast64_t node_count = transition_matrix->getRowCount();
mrmc::models::AtomicPropositionsLabeling* labeling = mrmc::models::AtomicPropositionsLabeling* labeling =
mrmc::parser::read_lab_file(node_count, lab_file);
mrmc::parser::readLabFile(node_count, lab_file);
mrmc::models::Dtmc<double>* result = mrmc::models::Dtmc<double>* result =
new mrmc::models::Dtmc<double>(transition_matrix, labeling); new mrmc::models::Dtmc<double>(transition_matrix, labeling);

12
test/parser/read_lab_file_test.cpp

@ -8,13 +8,13 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "MRMCConfig.h" #include "MRMCConfig.h"
#include "src/models/atomic_propositions_labeling.h" #include "src/models/atomic_propositions_labeling.h"
#include "src/parser/read_lab_file.h"
#include "src/parser/readLabFile.h"
#include "src/exceptions/file_IO_exception.h" #include "src/exceptions/file_IO_exception.h"
#include "src/exceptions/wrong_file_format.h" #include "src/exceptions/wrong_file_format.h"
TEST(ReadLabFileTest, NonExistingFileTest) { TEST(ReadLabFileTest, NonExistingFileTest) {
//No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-)
ASSERT_THROW(mrmc::parser::read_lab_file(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception);
ASSERT_THROW(mrmc::parser::readLabFile(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception);
} }
TEST(ReadLabFileTest, ParseTest) { TEST(ReadLabFileTest, ParseTest) {
@ -22,7 +22,7 @@ TEST(ReadLabFileTest, ParseTest) {
mrmc::models::AtomicPropositionsLabeling* labeling = NULL; mrmc::models::AtomicPropositionsLabeling* labeling = NULL;
//Parsing the file //Parsing the file
ASSERT_NO_THROW(labeling = mrmc::parser::read_lab_file(12, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/pctl_general_input_01.lab"));
ASSERT_NO_THROW(labeling = mrmc::parser::readLabFile(12, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/pctl_general_input_01.lab"));
//Checking whether all propositions are in the labelling //Checking whether all propositions are in the labelling
@ -82,14 +82,14 @@ TEST(ReadLabFileTest, ParseTest) {
} }
TEST(ReadLabFileTest, WrongHeaderTest1) { TEST(ReadLabFileTest, WrongHeaderTest1) {
ASSERT_THROW(mrmc::parser::read_lab_file(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::wrong_file_format);
ASSERT_THROW(mrmc::parser::readLabFile(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::wrong_file_format);
} }
TEST(ReadLabFileTest, WrongHeaderTest2) { TEST(ReadLabFileTest, WrongHeaderTest2) {
ASSERT_THROW(mrmc::parser::read_lab_file(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::wrong_file_format);
ASSERT_THROW(mrmc::parser::readLabFile(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::wrong_file_format);
} }
TEST(ReadLabFileTest, WrongPropositionTest) { TEST(ReadLabFileTest, WrongPropositionTest) {
ASSERT_THROW(mrmc::parser::read_lab_file(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::wrong_file_format);
ASSERT_THROW(mrmc::parser::readLabFile(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::wrong_file_format);
} }

12
test/parser/read_tra_file_test.cpp

@ -8,7 +8,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "MRMCConfig.h" #include "MRMCConfig.h"
#include "src/sparse/static_sparse_matrix.h" #include "src/sparse/static_sparse_matrix.h"
#include "src/parser/read_tra_file.h"
#include "src/parser/readTraFile.h"
#include "src/exceptions/file_IO_exception.h" #include "src/exceptions/file_IO_exception.h"
#include "src/exceptions/wrong_file_format.h" #include "src/exceptions/wrong_file_format.h"
#include <pantheios/pantheios.hpp> #include <pantheios/pantheios.hpp>
@ -16,7 +16,7 @@
TEST(ReadTraFileTest, NonExistingFileTest) { TEST(ReadTraFileTest, NonExistingFileTest) {
pantheios::log_INFORMATIONAL("Started NonExistingFileTest"); pantheios::log_INFORMATIONAL("Started NonExistingFileTest");
//No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-)
ASSERT_THROW(mrmc::parser::read_tra_file(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception);
ASSERT_THROW(mrmc::parser::readTraFile(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception);
} }
/* The following test case is based on one of the original MRMC test cases /* The following test case is based on one of the original MRMC test cases
@ -24,7 +24,7 @@ TEST(ReadTraFileTest, NonExistingFileTest) {
TEST(ReadTraFileTest, ParseFileTest1) { TEST(ReadTraFileTest, ParseFileTest1) {
pantheios::log_INFORMATIONAL("Started ParseFileTest1"); pantheios::log_INFORMATIONAL("Started ParseFileTest1");
mrmc::sparse::StaticSparseMatrix<double> *result = NULL; mrmc::sparse::StaticSparseMatrix<double> *result = NULL;
ASSERT_NO_THROW(result = mrmc::parser::read_tra_file(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/csl_general_input_01.tra"));
ASSERT_NO_THROW(result = mrmc::parser::readTraFile(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/csl_general_input_01.tra"));
if (result != NULL) { if (result != NULL) {
double val = 0; double val = 0;
@ -73,17 +73,17 @@ TEST(ReadTraFileTest, ParseFileTest1) {
TEST(ReadTraFileTest, WrongFormatTestHeader1) { TEST(ReadTraFileTest, WrongFormatTestHeader1) {
pantheios::log_INFORMATIONAL("Started WrongFormatTestHeader1"); pantheios::log_INFORMATIONAL("Started WrongFormatTestHeader1");
ASSERT_THROW(mrmc::parser::read_tra_file(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::wrong_file_format);
ASSERT_THROW(mrmc::parser::readTraFile(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::wrong_file_format);
} }
TEST(ReadTraFileTest, WrongFormatTestHeader2) { TEST(ReadTraFileTest, WrongFormatTestHeader2) {
pantheios::log_INFORMATIONAL("Started WrongFormatTestHeader2"); pantheios::log_INFORMATIONAL("Started WrongFormatTestHeader2");
ASSERT_THROW(mrmc::parser::read_tra_file(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::wrong_file_format);
ASSERT_THROW(mrmc::parser::readTraFile(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::wrong_file_format);
} }
TEST(ReadTraFileTest, WrongFormatTestTransition) { TEST(ReadTraFileTest, WrongFormatTestTransition) {
pantheios::log_INFORMATIONAL("Started WrongFormatTestTransition"); pantheios::log_INFORMATIONAL("Started WrongFormatTestTransition");
ASSERT_THROW(mrmc::parser::read_tra_file(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::wrong_file_format);
ASSERT_THROW(mrmc::parser::readTraFile(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::wrong_file_format);
} }
Loading…
Cancel
Save