add new interval comparison function and tests