Page MenuHomeWildfire Games

Add a test for circular splash damage
ClosedPublic

Authored by fatherbushido on Aug 12 2017, 9:47 AM.

Details

Summary

Test CauseSplashDamage with circular shape.
A bit of code duplication but meh.
That one would have caught rP19969.

Test Plan

-

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

fatherbushido created this revision.Aug 12 2017, 9:47 AM
elexis added a subscriber: elexis.Aug 12 2017, 10:09 AM

Test is good, it indeed catches the bug fixed by rP19969.

binaries/data/mods/public/simulation/components/tests/test_Damage.js
224 ↗(On Diff #3085)

Could be function TestCircularSplashDamage(), // Test Circular Splash Damage or stay as is.

230 ↗(On Diff #3085)

attacker and attackerOwner are used only once and the other playerIDs below don't get consts, so would be consistent to inline this as well.

243 ↗(On Diff #3085)

Nicer to read if data is inlined at cmpDamage.CauseSplashDamage(data), so that the reader doesn't have to lookup where it's used and what it should contain.
radius is the only thing read more than once and could become a const here.

247 ↗(On Diff #3085)

unneeded parens

257 ↗(On Diff #3085)

Quotes for properties

elexis remarks

elexis accepted this revision.Aug 12 2017, 10:44 AM

Readability: Very well.
Correctness: Tests pass.
Completeness: (Unit tests themselves inherently can't be complete, because one can always construct uncovered cases, for example a case with "killed": true.)
But the proposed test is complete with regards to it's intention, because the tests succeed with rP19969 and fail before.

Don't really see anything that the test could miss.

binaries/data/mods/public/simulation/components/tests/test_Damage.js
308 ↗(On Diff #3086)

no semicolon here (L308)

This revision is now accepted and ready to land.Aug 12 2017, 10:44 AM
This revision was automatically updated to reflect the committed changes.

thx for the review

Vulcan added a subscriber: Vulcan.Aug 12 2017, 11:24 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1842/ for more details.

Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/383/ for more details.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1843/ for more details.

Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/384/ for more details.

Build has FAILED

Link to build: http://jw:8080/job/phabricator/1844/
See console output for more information: http://jw:8080/job/phabricator/1844/console

Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/385/ for more details.