Path: blob/main/src/vs/base/test/common/numbers.test.ts
5257 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import assert from 'assert';6import { ensureNoDisposablesAreLeakedInTestSuite } from './utils.js';7import { isPointWithinTriangle } from '../../common/numbers.js';89suite('isPointWithinTriangle', () => {10ensureNoDisposablesAreLeakedInTestSuite();1112test('should return true if the point is within the triangle', () => {13const result = isPointWithinTriangle(0.25, 0.25, 0, 0, 1, 0, 0, 1);14assert.ok(result);15});1617test('should return false if the point is outside the triangle', () => {18const result = isPointWithinTriangle(2, 2, 0, 0, 1, 0, 0, 1);19assert.ok(!result);20});2122test('should return true if the point is on the edge of the triangle', () => {23const result = isPointWithinTriangle(0.5, 0, 0, 0, 1, 0, 0, 1);24assert.ok(result);25});26});272829