EWS/test: Make a deep copy of the comparison function
Otherwise it will become a dangling reference in case a lambda is supplied,