Self testing with array sorted