-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deleteSection and appendSection (#251)
* Remove the shared pointer const refs from the methods which change the shared pointer ref count. We had some problems when the const ref is used and added to a vector and then the vector is resized. * Fix the deleteSection method. Problems with the behavior of the c++ map [] accessor when the key is missing (for the rootSection).
- Loading branch information
Showing
11 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
set(TESTS_SRC | ||
main.cpp | ||
test_morphology.cpp | ||
test_mut_morphology.cpp | ||
) | ||
|
||
add_executable(unittests ${TESTS_SRC}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
((Dendrite) | ||
(3 -4 0 2) | ||
( | ||
(3 -10 2 4) | ||
| | ||
(3 -10 0 2) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "contrib/catch.hpp" | ||
|
||
#include <morphio/mut/morphology.h> | ||
|
||
|
||
TEST_CASE("RemoveRootsection", "[mutMorphology]") { | ||
// this test verifies we can delete a root section with recursive at false from a morphology | ||
// correctly. This is a special case where the root section as a single point and 2 child | ||
// sections. The number of sections is small enough to trigger a resize on _rootSections. | ||
morphio::mut::Morphology morpho("data/single_point_root.asc"); | ||
for (const auto& rootSection : morpho.rootSections()) { | ||
if (rootSection->points().size() == 1) { | ||
morpho.deleteSection(rootSection, false); | ||
} | ||
} | ||
REQUIRE(morpho.rootSections().size() == 2); | ||
} |