Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/test/common/numbers.test.ts
5257 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import assert from 'assert';
7
import { ensureNoDisposablesAreLeakedInTestSuite } from './utils.js';
8
import { isPointWithinTriangle } from '../../common/numbers.js';
9
10
suite('isPointWithinTriangle', () => {
11
ensureNoDisposablesAreLeakedInTestSuite();
12
13
test('should return true if the point is within the triangle', () => {
14
const result = isPointWithinTriangle(0.25, 0.25, 0, 0, 1, 0, 0, 1);
15
assert.ok(result);
16
});
17
18
test('should return false if the point is outside the triangle', () => {
19
const result = isPointWithinTriangle(2, 2, 0, 0, 1, 0, 0, 1);
20
assert.ok(!result);
21
});
22
23
test('should return true if the point is on the edge of the triangle', () => {
24
const result = isPointWithinTriangle(0.5, 0, 0, 0, 1, 0, 0, 1);
25
assert.ok(result);
26
});
27
});
28
29