Moved sorting tests to separate file, and made them same for all sorts
implemented. Small refactoring is also applied.