Skip to content

Commit a047ab5

Browse files
extent attribute tests (parallle/serial)
extent attribute test case - write attribute to a not existing group - validate written attribute
1 parent f9ebe2e commit a047ab5

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

tests/AttributesTest.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ void AttributesTest::testDataAttributes()
7878

7979
dataCollector->writeAttribute(10, ctInt, NULL, "iteration", &sum2);
8080

81+
int groupNotExistsTestValue = 42;
82+
/* check if it is possible to add an attribute to a not existing group */
83+
dataCollector->writeAttribute(0, ctInt, "notExistingGroup/", "magic_number", &groupNotExistsTestValue);
84+
8185
/* variable length string, '\0' terminated */
8286
const char *string_attr = {"My first c-string."};
8387
dataCollector->writeAttribute(10, ctString, NULL, "my_string", &string_attr);
@@ -124,6 +128,10 @@ void AttributesTest::testDataAttributes()
124128

125129
dataCollector->open(TEST_FILE, attr);
126130

131+
int readGroupNotExistsTestValue = 0;
132+
dataCollector->readAttribute(0, "notExistingGroup/", "magic_number", &readGroupNotExistsTestValue);
133+
CPPUNIT_ASSERT(groupNotExistsTestValue == readGroupNotExistsTestValue);
134+
127135
dataCollector->readAttribute(10, NULL, "iteration", &sum2);
128136

129137
char* string_read;

tests/Parallel_AttributesTest.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ void Parallel_AttributesTest::testDataAttributes()
8787
dummy_data[2 * i + 1] = val_y;
8888
}
8989

90+
int groupNotExistsTestValue = 42;
91+
/* check if it is possible to add an attribute to a not existing group */
92+
dataCollector->writeAttribute(0, ctInt, "notExistingGroup/", "magic_number", &groupNotExistsTestValue);
93+
9094
dataCollector->write(0, ctInt2, 1, Selection(Dimensions(BUF_SIZE, 1, 1)),
9195
"attr/attr2/attr3/data", dummy_data);
9296

@@ -120,6 +124,10 @@ void Parallel_AttributesTest::testDataAttributes()
120124

121125
dataCollector->open(TEST_FILE, attr);
122126

127+
int readGroupNotExistsTestValue = 0;
128+
dataCollector->readAttribute(0, "notExistingGroup/", "magic_number", &readGroupNotExistsTestValue);
129+
CPPUNIT_ASSERT(groupNotExistsTestValue == readGroupNotExistsTestValue);
130+
123131
sum = 0;
124132
neg_sum = 0;
125133
c = 'A';

0 commit comments

Comments
 (0)