scroll/src/common/types.ts

40 lines
1.1 KiB
JavaScript

// ----------------------------------------------------------------------------
// General types
// ----------------------------------------------------------------------------
export class Position {
public x: number;
public y: number;
private constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
public static at(x: number, y: number): Position {
return new Position(x, y);
}
public static default(): Position {
return new Position(0, 0);
}
}
// ----------------------------------------------------------------------------
// Testing
// ----------------------------------------------------------------------------
/**
* The shared test interface, so tests can be run by both runtimes
*/
export interface ITestBase {
assertEquals(actual: unknown, expected: unknown): void;
assertExists(actual: unknown): void;
assertFalse(actual: boolean): void;
assertInstanceOf(actual: unknown, expectedType: any): void;
assertNotEquals(actual: unknown, expected: unknown): void;
assertStrictEquals(actual: unknown, expected: unknown): void;
assertTrue(actual: boolean): void;
testSuite(testObj: any): void;
}