mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 02:12:41 +00:00
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { Geodesic } from '@modules/geography/infrastructure/geodesic';
|
|
|
|
describe('Matcher geodesic', () => {
|
|
it('should be defined', () => {
|
|
const geodesic: Geodesic = new Geodesic();
|
|
expect(geodesic).toBeDefined();
|
|
});
|
|
it('should get inverse values', () => {
|
|
const geodesic: Geodesic = new Geodesic();
|
|
const inv = geodesic.inverse(0, 0, 1, 1);
|
|
expect(Math.round(inv.azimuth as number)).toBe(45);
|
|
expect(Math.round(inv.distance as number)).toBe(156900);
|
|
});
|
|
it('should get azimuth value', () => {
|
|
const geodesic: Geodesic = new Geodesic();
|
|
const azimuth = geodesic.azimuth(0, 0, 1, 1);
|
|
expect(Math.round(azimuth as number)).toBe(45);
|
|
});
|
|
it('should get distance value', () => {
|
|
const geodesic: Geodesic = new Geodesic();
|
|
const distance = geodesic.distance(0, 0, 1, 1);
|
|
expect(Math.round(distance as number)).toBe(156900);
|
|
});
|
|
it('should throw an exception if inverse fails', () => {
|
|
const geodesic: Geodesic = new Geodesic();
|
|
expect(() => {
|
|
geodesic.inverse(7.74547, 48.583035, 7.74547, 48.583036);
|
|
}).toThrow();
|
|
});
|
|
it('should throw an exception if azimuth fails', () => {
|
|
const geodesic: Geodesic = new Geodesic();
|
|
expect(() => {
|
|
geodesic.azimuth(7.74547, 48.583035, 7.74547, 48.583036);
|
|
}).toThrow();
|
|
});
|
|
});
|