🚀 draw world

This commit is contained in:
platane
2020-07-18 17:02:35 +02:00
parent e9654e7e66
commit a149bab26a
16 changed files with 472 additions and 13 deletions

View File

@@ -0,0 +1,26 @@
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);
});