From fcb410631aa5e45e8155a05f4fb29d949e5168c9 Mon Sep 17 00:00:00 2001 From: BatchelorJ Date: Mon, 26 Nov 2018 09:26:43 +1100 Subject: [PATCH] geodepy.test_geodesy Initial work on new test for vincentys inverse edgecases to resolve bug in Issue #35 geodepy.test_convert add if name is main to eof --- geodepy/tests/test_convert.py | 4 ++++ geodepy/tests/test_geodesy.py | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/geodepy/tests/test_convert.py b/geodepy/tests/test_convert.py index 68f139a..cb99b95 100644 --- a/geodepy/tests/test_convert.py +++ b/geodepy/tests/test_convert.py @@ -77,3 +77,7 @@ def test_hp2dms(self): def test_hp2ddm(self): self.assertEqual(ddm_ex, hp2ddm(hp_ex)) self.assertEqual(-ddm_ex, hp2ddm(-hp_ex)) + + +if __name__ == '__main__': + unittest.main() diff --git a/geodepy/tests/test_geodesy.py b/geodepy/tests/test_geodesy.py index f204d7b..e695a9f 100644 --- a/geodepy/tests/test_geodesy.py +++ b/geodepy/tests/test_geodesy.py @@ -66,9 +66,22 @@ def test_equality_vincentys(self): vincdir_result[:, 0], decimal=8) np.testing.assert_almost_equal(test_pairs['long2'], vincdir_result[:, 1], decimal=8) - np.testing.assert_almost_equal(vincinv_result[:,2], + np.testing.assert_almost_equal(vincinv_result[:, 2], vincdir_result[:, 2]) + def test_vincinv_edgecases(self): + lat1 = -32.153892 + lon1 = -15.394827 + lat2 = -31.587369 + lon2 = -13.487739 + gdist, az12, az21 = vincinv(lat1, lon1, lat2, lon2) + lon1 = lon1 + 14 + lon2 = lon2 + 14 + gdist_2, az12_2, az21_2 = vincinv(lat1, lon1, lat2, lon2) + self.assertEqual(gdist, gdist_2) + self.assertEqual(az12, az12_2) + self.assertEqual(az21, az21_2) + if __name__ == '__main__': unittest.main()