blob: 421eb17ea7c2d0dba0d7d15e10097c0de7a9661b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
'use strict';
import { Point } from './topology';
test('Point works correctly', () => {
const p = Point(0, 1);
expect(p.layer).toBe(0);
expect(p.index).toBe(1);
expect(() => p.layer = 5).toThrow();
});
test('Point equality works correctly', () => {
const a00 = Point(0, 0);
const b00 = Point(0, 0);
const a01 = Point(0, 1);
const b01 = Point(0, 1);
const a10 = Point(1, 0);
const b10 = Point(1, 0);
const a11 = Point(1, 1);
const b11 = Point(1, 1);
expect(a00 == b00).toBeTruthy();
expect(a01 == b01).toBeTruthy();
expect(a10 == b10).toBeTruthy();
expect(a11 == b11).toBeTruthy();
expect(a00 == a01).toBeFalsy();
expect(a00 == a10).toBeFalsy();
expect(a00 == a11).toBeFalsy();
});
|