Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Framework/Nexus/inc/MantidNexus/nxstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void setCloseID(pFileStack self, const NXlink &id);

int fileStackDepth(pFileStack self);

void pushPath(pFileStack self, const char *name);
void pushPath(pFileStack self, const char *name, bool isdata = false);
void popPath(pFileStack self);
int buildPath(pFileStack self, char *path, int pathlen);

Expand Down
2 changes: 1 addition & 1 deletion Framework/Nexus/src/napi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ NXstatus NXopendata(NXhandle fid, CONSTCHAR *name) {
status = LOCKED_CALL(pFunc->nxopendata(pFunc->pNexusData, name));

if (status == NXstatus::NX_OK) {
pushPath(fileStack, name);
pushPath(fileStack, name, true);
}

char nxurl[1024];
Expand Down
4 changes: 2 additions & 2 deletions Framework/Nexus/src/nxstack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ void setCloseID(pFileStack self, const NXlink &id) { self->fileStack[self->fileS
/*----------------------------------------------------------------------*/
int fileStackDepth(pFileStack self) { return self->fileStackPointer; }
/*----------------------------------------------------------------------*/
void pushPath(pFileStack self, const char *name) {
if (self->pathPointer >= 0 && name == self->pathStack[self->pathPointer]) {
void pushPath(pFileStack self, const char *name, bool isdata) {
if (self->pathPointer >= 0 && name == self->pathStack[self->pathPointer] && isdata) {
return;
}
self->pathPointer++;
Expand Down
14 changes: 14 additions & 0 deletions Framework/Nexus/test/NeXusFileTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ class NeXusFileTest : public CxxTest::TestSuite {
TS_ASSERT_THROWS_NOTHING(file.makeGroup(grp, cls));
}

void test_same_make_group() {
cout << "\ntest same makeGroup\n";
FileResource resource("test_nexus_file_grp.h5");
std::string filename = resource.fullPath();
NeXus::File file(filename, NXACC_CREATE5);

string grp("test_group");

// check that we can make '/test_group/test_group'
TS_ASSERT_THROWS_NOTHING(file.makeGroup(grp, "NXsample", true));
TS_ASSERT_THROWS_NOTHING(file.makeGroup(grp, "NXdata", true));
TS_ASSERT_EQUALS(file.getPath(), "/test_group/test_group");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty certain, for a workspace named "data", that this line will actually create a a dataset called "/data/data/data". We need a test for this inside SaveNXSETest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are correct, it is opening /data/data/data. Would a nominal test with the workspace named data be sufficient?

}

void test_open_group() {
cout << "\ntest openGroup\n";
FileResource resource("test_nexus_file_grp.h5");
Expand Down