segmentation unittest refactored