-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Z order violation #179
Z order violation #179
Conversation
Looks okay. BTW, the test that I posted reliably triggers the problem:-). The section o1.isStamp && o2.isToken relies on the fact that factually isToken = !isStamp. If this were not the case in the future, we will have the problem again. I advise to change either isToken or isStamp to the reverse of the other. Comments from Reviewable |
I think I agree. On the one hand, it might read better to use isStamp() and isToken(), but if the list of token types should change in the future, it’s likely that a type other than Stamp and Token would fall through the cracks. I’d say pick one and replace the other with “! ...” And yes, the code iris put in the issue repeatedly recreates the problem, although I have to admit the use of random means it’s not guaranteed (although the larger the sample set, the more likely it is). Which just goes to show we need more unit testing! The MT code that exists now makes it very difficult to create mockups necessary for such testing, but future architectural changes (i.e. changes to the class diagram) will require unit tests before they’re merged. Plan for dependency injection now. ;) |
The reason I chose random is that to reliably get timsort to break with a broken comparator is not that easy. In fact, 100 random tokens didn't work, I think. It also has the benefit that you can easily add other pertinent calls to token methods from the comparator to test it, without having to understand a root cause. I mean, if you knew a potential root cause, you can write a test for it, but the other way? |
Reviewed 2 of 3 files at r1, 1 of 1 files at r2. Comments from Reviewable |
I understand that 100 wasn't enough and that 1000 were needed. My point was that using random data isn't a good way to test code because you can't guarantee that it will generate the conditions needed to trigger a bug. However, a true mockup would be a PITA because you'd have to hand-code a bunch of specific values to test all parts of the code and for something like this comparator, even a code coverage tool isn't going to help much. (It'll tell you whether you took all branches of an IF statement or SWITCH statement, but that isn't helpful in trigger a contract failure like this one.) Anyway, it's good to have the test code and I may work it into a unit test at some point. I should probably search for all other comparators and tests for them as well... This is why procrastinators are never bored -- there's always something to do. ;) |
Pulled from upstream: RPTools#179 Signed-off-by: Jamz <Jamz@Nerps.net>
* #49: Add proper pathfinding taking VBL into account - Total WIP POC Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account - Cleaned up code a bit, Tweaked heuristic - Currently avoids any cell that has any VBL in it... to be tweaked later Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account - Buildable version... Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * Bug Fix - Preference Diaglog would error if launched from JAR or IDE as it would be missing native libs for JVMPreferences. StartUp tab is now disabled if not launched from native executable/missing packager lib. Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account - More progress on A* - Added Terrain Modifiers calculation and option on Token properties - WIP on multi threading... Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * Bug Fix - Inno Setup - Restored iss prop so directory will always populate during windows install - Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account - Token Properties UI changes Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * Enhancement - FoW optimization! - Changed circles to 'fake' circles (removing curves from geometry) for faster Area.add calculations - WIP new "GRID" vision/light type! Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account - WIP A* Pathfinding - WIP new "GRID" vision/light type! Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * com.github.jai-imageio:jai-imageio-core bumped to 1.4.0 to support Java 9 Signed-off-by: Jamz <Jamz@Nerps.net> * Changed Sentry.IO to not log in Development envrionments. Signed-off-by: Jamz <Jamz@Nerps.net> * Fixes Z Order Violation Pulled from upstream: RPTools#179 Signed-off-by: Jamz <Jamz@Nerps.net> * Enhancement - Video Backgrounds * POC to add video as a background map 49: Add proper pathfinding taking VBL into account Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * Enhancement - #49: Add proper pathfinding taking VBL into account * Finished POC for ASTar Pathfinding, code cleanup * Spotless Applied * Had to remove grgit.branch.current().name for now, getting errors for unknown reason Signed-off-by: Jamz <Jamz@Nerps.net> * Updated Gradle Build * Removed JFX-Plugin * Updated Spotless version to 3.13 Signed-off-by: Jamz <Jamz@Nerps.net> * Updated for Spotless * Current spotless can not handle <pre> tags in comment section. Open issue in github: diffplug/spotless#191 Signed-off-by: Jamz <Jamz@Nerps.net> * Enhancement - Java 10! * Updated packaged JRE to Java 10. Signed-off-by: Jamz <Jamz@Nerps.net> * Update .appveyor.yml Added Linux build * Update .travis.yml Removed Linux from the matrix * Moving linux build to appveyor * Setting JAVA_HOME for windows only per matrix Signed-off-by: Jamz <Jamz@Nerps.net> * Moving linux build to appveyor * Setting JAVA_HOME for windows only per matrix Signed-off-by: Jamz <Jamz@Nerps.net> * Another appveyor test Signed-off-by: Jamz <Jamz@Nerps.net> * YAT Signed-off-by: Jamz <Jamz@Nerps.net> * YAT Signed-off-by: Jamz <Jamz@Nerps.net> * Update .appveyor.yml Trigger appveyor $%$@#%# * Appveyor not kicking off... Signed-off-by: Jamz <Jamz@Nerps.net> * Enhancement - AutoUpdate * Added tag name to Auto Update message * Appveyor environment var bug fix Signed-off-by: Jamz <Jamz@Nerps.net> * YAT Signed-off-by: Jamz <Jamz@Nerps.net> * YAT Appveyor not kicking off if only yml chnaged? Signed-off-by: Jamz <Jamz@Nerps.net> * YAT 2 Signed-off-by: Jamz <Jamz@Nerps.net> * WTF Signed-off-by: Jamz <Jamz@Nerps.net> * Attempt #12 Signed-off-by: Jamz <Jamz@Nerps.net> * Attempt #13 Signed-off-by: Jamz <Jamz@Nerps.net> * looking for java... Signed-off-by: Jamz <Jamz@Nerps.net> * Attempt #15 Signed-off-by: Jamz <Jamz@Nerps.net> * Attempt #16 Signed-off-by: Jamz <Jamz@Nerps.net> * Sigh... manually install jdk 10 Signed-off-by: Jamz <Jamz@Nerps.net> * Hrm Signed-off-by: Jamz <Jamz@Nerps.net> * Well, can we go with java 9 then? Signed-off-by: Jamz <Jamz@Nerps.net> * Update .appveyor.yml Adding manual install of Open JDK 10 * Update .appveyor.yml Checking gradle version * Update .appveyor.yml change to unix gradle wrapper * Update .appveyor.yml Attempting to install oracle's JDK 10... * Update .appveyor.yml sigh...will this ever work... * Update .appveyor.yml one more try, why not... * Update .appveyor.yml Getting closer... now setting JAVA_HOME * Update .appveyor.yml adding fakeroot... * Update .appveyor.yml learn to type... * Update .appveyor.yml Finally working version for linux, Final tweaks... * Update .appveyor.yml Adding windows back. * Note sh: commands should only run on linux, build scripts should run on both * Update build.gradle Updated vendor to Nerps from Nerps-BETA. * Update .appveyor.yml Attempt to fix false spotless fails on windows VM * Update .appveyor.yml Adding init stage * Update .appveyor.yml added tag: $(APPVEYOR_REPO_TAG_NAME) * Update .appveyor.yml Test if linux/windows order matters * Update .appveyor.yml Uppercased APPVEYOR_REPO_TAG for Linux * Enhancement #68 - Changing Language * Added JVM User Option to change default MapTool language via Edit -> Preferences -> Startup tab * Moved MAPTOOL_DATADIR from JvmOptions to userJvmOptions and enabled user setting in Edit -> Preferences -> Startup tab Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account * Pathfinding now properly works for Hex grid! * Refactored and cleaned up code for AStar Pathfinding Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net> * #63 Restore default behavior of spacebar+left mouse click * Spacebar functionality has been restored to it's original behavior including ctrl+spacebar & shift+spacebar as well. * A new shift+ctrl+spacebar command along with a new pointer image is now available. When this keystroke combo is pressed, and you are a GM, the pointer will center & zoom all connected clients to that point. When it is released, all clients will return to their previous view point & zoom. Task-Url: #63 Signed-off-by: Jamz <Jamz@Nerps.net> * Spotless... Signed-off-by: Jamz <Jamz@Nerps.net> * #67: New Vision/Light type: GRID * Clear gridShapeCache on grid change * Instatiante footprint field to prevent null pointer on measuring tool. Task-Url: #67 Signed-off-by: Jamz <Jamz@Nerps.net> * #49: Add proper pathfinding taking VBL into account * When token movement is done (left click released) we now wait for the final background thread for A* Pathfinding is to either finish or time out so quick or long moves get a chance to render a path. Task-Url: #49 Signed-off-by: Jamz <Jamz@Nerps.net>
Replacement for closed PR RPTools#179
Replacement for closed PR #179
This solves the ZOrder sort violation problem by restoring the original comparator and only using the new figure comparator when sorting figure only.
Difficult to say this absolutely solves the problem as we have never been able to reliably trigger the error.
This change is