Unit tested distance and similarity measures and useful functions