Regroup Instantiation tests

This commit is contained in:
Marty Oehme 2018-08-30 10:17:31 +02:00
parent fb481669ed
commit eef7a23c8f

View file

@ -30,45 +30,49 @@ void main() {
Grid sut = Grid(87, 85); Grid sut = Grid(87, 85);
expect(sut.length, 7395); expect(sut.length, 7395);
}, tags: const ["happy"]); }, tags: const ["happy"]);
test("copies the content of another grid on .from Constructor call", () { group(".from", () {
Grid original = Grid(2, 2); test("copies the content of another grid on .from Constructor call", () {
original[0] = "Hey"; Grid original = Grid(2, 2);
original[1] = "you"; original[0] = "Hey";
original[2] = "me"; original[1] = "you";
original[3] = "together"; original[2] = "me";
original[3] = "together";
Grid sut = Grid.from(original); Grid sut = Grid.from(original);
expect(sut, containsAllInOrder(["Hey", "you", "me", "together"])); expect(sut, containsAllInOrder(["Hey", "you", "me", "together"]));
}, tags: const ["happy"]); }, tags: const ["happy"]);
test("copies the length of another grid on .from Constructor call", () { test("copies the length of another grid on .from Constructor call", () {
Grid original = Grid(2, 2); Grid original = Grid(2, 2);
original[0] = "Hey"; original[0] = "Hey";
original[1] = "you"; original[1] = "you";
original[2] = "me"; original[2] = "me";
original[3] = "together"; original[3] = "together";
Grid sut = Grid.from(original); Grid sut = Grid.from(original);
expect(sut.length, 4); expect(sut.length, 4);
}, tags: const ["happy"]); }, tags: const ["happy"]);
test("sets the length for list passed in on .fromList Constructor call", });
() { group(".fromList", () {
Grid sut = Grid.fromList(l, 3); test("sets the length for list passed in on .fromList Constructor call",
() {
Grid sut = Grid.fromList(l, 3);
expect(sut.length, 9); expect(sut.length, 9);
}, tags: const ["happy"]); }, tags: const ["happy"]);
test("sets the contents of list passed in on .fromList Constructor call", test("sets the contents of list passed in on .fromList Constructor call",
() { () {
Grid sut = Grid.fromList(l, 3); Grid sut = Grid.fromList(l, 3);
expect(sut[3], "together"); expect(sut[3], "together");
}, tags: const ["happy"]); }, tags: const ["happy"]);
test( test(
"sets the correct height for list passed in on .fromList Constructor call", "sets the correct height for list passed in on .fromList Constructor call",
() { () {
Grid sut = Grid.fromList(l, 3); Grid sut = Grid.fromList(l, 3);
expect(sut.width, 3); expect(sut.width, 3);
}, tags: const ["happy"]); }, tags: const ["happy"]);
});
}); });
group("toIndex", () { group("toIndex", () {
Grid sut; Grid sut;