feat: include boardSide.direction (#46)

* feat: implemented BoardSide.direction

* docs: included doc comment
pull/48/head
Alejandro Santiago 4 years ago committed by GitHub
parent 963b400c41
commit b93e104b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,4 +19,9 @@ extension BoardSideX on BoardSide {
/// Whether this side is [BoardSide.right]. /// Whether this side is [BoardSide.right].
bool get isRight => this == BoardSide.right; bool get isRight => this == BoardSide.right;
/// Direction of the [BoardSide].
///
/// Represents the path which the [BoardSide] moves along.
int get direction => isLeft ? -1 : 1;
} }

@ -23,5 +23,12 @@ void main() {
expect(side.isLeft, isFalse); expect(side.isLeft, isFalse);
expect(side.isRight, isTrue); expect(side.isRight, isTrue);
}); });
test('direction is correct', () {
const side = BoardSide.left;
expect(side.direction, equals(-1));
const side2 = BoardSide.right;
expect(side2.direction, equals(1));
});
}); });
} }

Loading…
Cancel
Save