hard-coded adaptation of Go's native sort for gen + tests; need to templatize