Differential D4658 Diff 20321 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Formation.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Formation.js
Show All 25 Lines | |||||
const cmpFormation = ConstructComponent(entity_id, "Formation", formationTemplate); | const cmpFormation = ConstructComponent(entity_id, "Formation", formationTemplate); | ||||
const testingAngles = []; | const testingAngles = []; | ||||
for (let i = 0; i < 179; i++) | for (let i = 0; i < 179; i++) | ||||
testingAngles.push(i * Math.PI / 180); | testingAngles.push(i * Math.PI / 180); | ||||
TS_ASSERT(testingAngles.every(x => !cmpFormation.AreAnglesSimilar(0, x))); | TS_ASSERT(testingAngles.every(x => !cmpFormation.DoesAngleDifferenceAllowTurning(0, x))); | ||||
TS_ASSERT(testingAngles.every(x => !cmpFormation.AreAnglesSimilar(0, -x))); | TS_ASSERT(testingAngles.every(x => !cmpFormation.DoesAngleDifferenceAllowTurning(0, -x))); | ||||
cmpFormation.maxTurningAngle = Math.PI; | cmpFormation.maxTurningAngle = Math.PI; | ||||
TS_ASSERT(testingAngles.every(x => cmpFormation.AreAnglesSimilar(0, x))); | TS_ASSERT(testingAngles.every(x => cmpFormation.DoesAngleDifferenceAllowTurning(0, x))); | ||||
TS_ASSERT(testingAngles.every(x => cmpFormation.AreAnglesSimilar(0, -x))); | TS_ASSERT(testingAngles.every(x => cmpFormation.DoesAngleDifferenceAllowTurning(0, -x))); |
Wildfire Games · Phabricator