Shorten toggleCell Function Name

This commit is contained in:
Unknown 2018-10-23 21:01:27 +02:00
parent 2e7fd7c3d3
commit e40dddde52
2 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ class Simulation {
return math.Point<int>(cx.toInt(), cy.toInt());
}
void toggleCellState(int x, int y) {
void toggleCell(int x, int y) {
map.set(x, y, !map.get(x, y));
}

View File

@ -52,16 +52,16 @@ void main() {
}, tags: "nobrowser");
group("toggleCellState", () {
test("throws RangeError if outside the map bounds", () {
expect(() => sut.toggleCellState(10, 9), throwsRangeError);
expect(() => sut.toggleCell(10, 9), throwsRangeError);
}, tags: const ["nobrowser"]);
test("sets the cell to false if currently true", () {
sut.map.set(1, 1, true);
sut.toggleCellState(1, 1);
sut.toggleCell(1, 1);
expect(sut.map.get(1, 1), false);
}, tags: const ["nobrowser"]);
test("sets the cell to true if currently false", () {
sut.map.set(1, 1, false);
sut.toggleCellState(1, 1);
sut.toggleCell(1, 1);
expect(sut.map.get(1, 1), true);
}, tags: const ["nobrowser"]);
});