Added directory sorting to directory tests