Implement logic for sorting array write tests.