Add test cases.
Extract pipe for sort.