27 lines
544 B
TypeScript
27 lines
544 B
TypeScript
import { generateEmptyGrid } from "../generateGrid";
|
|
import { setColor, getColor, isInside } from "../grid";
|
|
|
|
it("should set / get cell", () => {
|
|
const grid = generateEmptyGrid(2, 3);
|
|
|
|
expect(getColor(grid, 0, 1)).toBe(null);
|
|
|
|
setColor(grid, 0, 1, 1);
|
|
|
|
expect(getColor(grid, 0, 1)).toBe(1);
|
|
});
|
|
|
|
test.each([
|
|
[0, 1, true],
|
|
[1, 2, true],
|
|
|
|
[-1, 1, false],
|
|
[0, -1, false],
|
|
[2, 1, false],
|
|
[0, 3, false],
|
|
])("isInside", (x, y, output) => {
|
|
const grid = generateEmptyGrid(2, 3);
|
|
|
|
expect(isInside(grid, x, y)).toBe(output);
|
|
});
|