Browse Source

Minor corrections (Memory initialization in AtomicProposition) and

more
test
cases
tempestpy_adaptions
Thomas Heinemann 12 years ago
committed by Lanchid
parent
commit
8e460897f0
  1. 8
      src/dtmc/atomic_proposition.h
  2. 12
      test/parser/read_lab_file_test.cpp

8
src/dtmc/atomic_proposition.h

@ -51,9 +51,11 @@ class AtomicProposition {
void initialize(uint_fast32_t nodeCount) { void initialize(uint_fast32_t nodeCount) {
if (node_array == NULL) { if (node_array == NULL) {
node_count = nodeCount; node_count = nodeCount;
node_array = new uint_fast64_t[(int) std::ceil(nodeCount / 64)]();
if (node_array == NULL) {
throw std::bad_alloc();
int n = (int) std::ceil(nodeCount / 64.0);
node_array = new uint_fast64_t[n];
//Initialization with 0 is crucial!
for (int i = 0; i < n; i++) {
node_array[i] = 0L;
} }
} }

12
test/parser/read_lab_file_test.cpp

@ -75,3 +75,15 @@ TEST(ReadLabFileTest, ParseTest) {
//Deleting the labelling //Deleting the labelling
delete labelling; delete labelling;
} }
TEST(ReadLabFileTest, WrongHeaderTest1) {
ASSERT_THROW(mrmc::parser::read_lab_file(3,"test/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::wrong_file_format);
}
TEST(ReadLabFileTest, WrongHeaderTest2) {
ASSERT_THROW(mrmc::parser::read_lab_file(3,"test/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::wrong_file_format);
}
TEST(ReadLabFileTest, WrongPropositionTest) {
ASSERT_THROW(mrmc::parser::read_lab_file(3,"test/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::wrong_file_format);
}
Loading…
Cancel
Save