Files
GDevelop/GDJS/tests/benchmarks/polygon.js
T
2018-12-26 23:22:10 +01:00

25 lines
798 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);
})
.add('collisionTest between two non overlapping rectangles', i => {
gdjs.Polygon.collisionTest(rect1, rect3);
});
console.log(benchmarkSuite.run());
});
});