Temporarily add transpiled BRouter CheapRuler
for better comparison during development
This commit is contained in:
parent
af1a11872a
commit
bd2e89ef06
2 changed files with 127 additions and 0 deletions
18
tests/util/CheapRuler.test.js
Normal file
18
tests/util/CheapRuler.test.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require('../../js/util/CheapRuler.js');
|
||||
|
||||
test('distance', () => {
|
||||
// https://github.com/abrensch/brouter/issues/3#issuecomment-440375918
|
||||
const latlng1 = [48.8124, 2.3158];
|
||||
const latlng2 = [48.8204, 2.321];
|
||||
|
||||
const ilon1 = (latlng1[1] + 180) * 1e6;
|
||||
const ilat1 = (latlng1[0] + 90) * 1e6;
|
||||
const ilon2 = (latlng2[1] + 180) * 1e6;
|
||||
const ilat2 = (latlng2[0] + 90) * 1e6;
|
||||
|
||||
const distance = btools.util.CheapRuler.distance(ilon1, ilat1, ilon2, ilat2);
|
||||
|
||||
// 968.1670119067338 - issue #3 (App.java)
|
||||
// 968.0593622374572 - CheapRuler.java
|
||||
expect(distance).toBeCloseTo(968.0593622374572);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue