This diff adds some more initial test cases to document the current behavior of the code.
This way, classes using wrong math like TileClass will have their bugs documented in test cases.
Details
- Reviewers
- None
- Commits
- rP23460: Some more random random map script unit tests and ASSERT functions, refs #4827.
Notice there is little test coverage and consider which cases would be most interesting or necessary to add next.
(Eventually there should be unit tests for every rmgen class.)
One can check the correctness (or reproduce the incorrectness of numbers) using the new_rms_test map and printing the areas and visually confirming that the area is what is intended.
The TileClass numbers themselves are known to be wrong (refs infamous '#27' algorithm difference in TileClass.js)
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
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1675/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (new-parens): | | Missing '()' invoking a constructor. |----| | /zpool0/trunk/binaries/data/tests/test_setup.js | |++++| /zpool0/trunk/binaries/data/tests/test_setup.js | 8| 8| function fail(msg) | 9| 9| { | 10| 10| // Get a list of callers | 11| |- let trace = (new Error).stack.split("\n"); | | 11|+ let trace = (new Error()).stack.split("\n"); | 12| 12| // Remove the Error ctor and this function from the stack | 13| 13| trace = trace.splice(2); | 14| 14| trace = "Stack trace:\n" + trace.join("\n"); binaries/data/tests/test_setup.js | 54| » }·catch·(e)·{ | | [NORMAL] ESLintBear (no-empty): | | Empty block statement. binaries/data/tests/test_setup.js | 11| » let·trace·=·(new·Error).stack.split("\n"); | | [NORMAL] JSHintBear: | | Missing '()' invoking a constructor. binaries/data/tests/test_setup.js | 31| » if·(!(x·===·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 45| » if·(!(uneval(x)·===·uneval(y))) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 66| » if·(!(x·<·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 72| » if·(!(x·>·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 78| » if·(!(x·<=·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 84| » if·(!(x·>=·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1680/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (new-parens): | | Missing '()' invoking a constructor. |----| | /zpool0/trunk/binaries/data/tests/test_setup.js | |++++| /zpool0/trunk/binaries/data/tests/test_setup.js | 8| 8| function fail(msg) | 9| 9| { | 10| 10| // Get a list of callers | 11| |- let trace = (new Error).stack.split("\n"); | | 11|+ let trace = (new Error()).stack.split("\n"); | 12| 12| // Remove the Error ctor and this function from the stack | 13| 13| trace = trace.splice(2); | 14| 14| trace = "Stack trace:\n" + trace.join("\n"); binaries/data/tests/test_setup.js | 54| » }·catch·(e)·{ | | [NORMAL] ESLintBear (no-empty): | | Empty block statement. binaries/data/tests/test_setup.js | 11| » let·trace·=·(new·Error).stack.split("\n"); | | [NORMAL] JSHintBear: | | Missing '()' invoking a constructor. binaries/data/tests/test_setup.js | 31| » if·(!(x·===·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 45| » if·(!(uneval(x)·===·uneval(y))) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 66| » if·(!(x·<·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 72| » if·(!(x·>·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 78| » if·(!(x·<=·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. binaries/data/tests/test_setup.js | 84| » if·(!(x·>=·y)) | | [NORMAL] JSHintBear: | | Confusing use of '!'. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1681/display/redirect
(FWIW got an absence of objections from nani http://irclogs.wildfiregames.com/2020-01/2020-01-29-QuakeNet-%230ad-dev.log)