Add distance condition for auto resource sending

This commit is contained in:
2020-10-14 11:58:42 +03:00
parent 33964dc99b
commit 901bea6b4e
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,24 @@
import { it, describe } from 'mocha';
import { expect } from 'chai';
import { Coordinates } from '../../src/Core/Village';
describe('Coordinates', function () {
it('Can compare same', function () {
const a = new Coordinates(1, 1);
const b = new Coordinates(1, 1);
expect(a.eq(b)).is.true;
});
it('Can compare different', function () {
const a = new Coordinates(1, 1);
const b = new Coordinates(2, 1);
expect(a.eq(b)).is.false;
});
it('Can calc distance', function () {
const a = new Coordinates(0, 0);
const b = new Coordinates(-3, -4);
expect(a.dist(b)).is.equals(5);
});
});