first working version of test_distance.c