Add some tests and fix several bugs

This commit is contained in:
2022-02-01 23:39:56 +01:00
parent aaad8b1db6
commit 97e886d7ea
6 changed files with 452 additions and 72 deletions

View File

@@ -13,6 +13,13 @@ class Point {
operator *(covariant Point p) => Point(x * p.x, y * p.y);
operator /(covariant Point p) => Point(x / p.x, y / p.y);
@override
bool operator ==(Object other) =>
other is Point && x == other.x && y == other.y;
@override
int get hashCode => x.hashCode ^ y.hashCode;
Point addX(num n) => Point(x + n, y);
Point addY(num n) => Point(x, y + n);
Point add(num n) => Point(x + n, y + n);
@@ -38,4 +45,4 @@ class Point {
@override
String toString() => '($x,$y)';
}
}