Files
GDevelop/GDJS/tests/benchmarks/polygon.js
Florian Rival 8338ab666d Translate a bunch of GDJS files to TypeScript
Don't show in changelog
2021-01-08 19:54:37 +01:00

25 lines
812 B
JavaScript

describe('gdjs.Polygon', function() {
it('benchmark gdjs.Polygon.collisionTest between two polygons', function() {
this.timeout(20000);
var rect1 = gdjs.Polygon.createRectangle(32, 40);
var rect2 = gdjs.Polygon.createRectangle(32, 40);
var rect3 = gdjs.Polygon.createRectangle(32, 40);
rect2.move(20, 20);
rect3.move(50, 50);
const benchmarkSuite = makeBenchmarkSuite({
benchmarksCount: 20,
iterationsCount: 30000,
});
benchmarkSuite
.add('collisionTest between two overlapping rectangles', i => {
gdjs.Polygon.collisionTest(rect1, rect2, false);
})
.add('collisionTest between two non overlapping rectangles', i => {
gdjs.Polygon.collisionTest(rect1, rect3, false);
});
console.log(benchmarkSuite.run());
});
});