tests for distinct and related functions