WL-2351 Add unit tests on term sorting.