refactored shortest path tests to share test code