Topsort: Change tests to deal with nondeterminism.