Add simple test at c++ level for distance functions.