@ -6,6 +6,7 @@
*/
*/
# include "gtest/gtest.h"
# include "gtest/gtest.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/read_tra_file.h"
# include "src/exceptions/file_IO_exception.h"
# include "src/exceptions/file_IO_exception.h"
@ -15,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 ( " nonExistingFile.not " ) , mrmc : : exceptions : : file_IO_exception ) ;
ASSERT_THROW ( mrmc : : parser : : read_tra_file ( 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
@ -23,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 ;
mrmc : : sparse : : StaticSparseMatrix < double > * result ;
ASSERT_NO_THROW ( result = mrmc : : parser : : read_tra_file ( " test /parser/tra_files/csl_general_input_01.tra" ) ) ;
ASSERT_NO_THROW ( result = mrmc : : parser : : read_tra_file ( MRMC_CPP_TESTS_BASE_PATH " /parser/tra_files/csl_general_input_01.tra " ) ) ;
double val = 0 ;
double val = 0 ;
ASSERT_TRUE ( result - > getValue ( 1 , 1 , & val ) ) ;
ASSERT_TRUE ( result - > getValue ( 1 , 1 , & val ) ) ;
@ -65,17 +66,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 ( " test /parser/tra_files/wrong_format_header1.tra" ) , mrmc : : exceptions : : wrong_file_format ) ;
ASSERT_THROW ( mrmc : : parser : : read_tra_file ( 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 ( " test /parser/tra_files/wrong_format_header2.tra" ) , mrmc : : exceptions : : wrong_file_format ) ;
ASSERT_THROW ( mrmc : : parser : : read_tra_file ( 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 ( " test /parser/tra_files/wrong_format_transition.tra" ) , mrmc : : exceptions : : wrong_file_format ) ;
ASSERT_THROW ( mrmc : : parser : : read_tra_file ( MRMC_CPP_TESTS_BASE_PATH " /parser/tra_files/wrong_format_transition.tra " ) , mrmc : : exceptions : : wrong_file_format ) ;
}
}