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
TESTS: Add unit test for Engines::Trigger class #372
Conversation
All four tests should fail because the contains call is returning unexpected results. |
Huh. So our Trigger class is wrong? Good to know. Thanks for finding this! :) I don't want to merge failing tests, but this would be a good starting point to fix the code. Can you fix it, and add that to this PR? And move the fixing commits before the test. Also: c9b976c, b64b62f and 0e8ee66 shouldn't be their own commit, but they should be squashed into the commit 9d9b7b4. So that in the end, it looks like one commit that does the "right" thing from the start. Also also, to fix up a PR, you don't need to close it and open a new one, like you did with #369, #370 and #371. Instead, force-push to your remote branch that you used to base the PR off of. That will update the PR. |
I don't want to merge failing tests, but this would be a good starting
point to fix the code. Can you fix it, and add that to this PR? And move
the fixing commits before the test.
Yes, I was planning at looking at that next, assuming somebody else isn't
already doing an update. My initial approach is detailed on the GitHub
repository issues list. I'll do as you suggest, although I have no idea how
to move commits around like that.
Also: c9b976c
<c9b976c>
, b64b62f
<b64b62f>
and 0e8ee66
<0e8ee66>
shouldn't be their own commit, but they should be squashed into the commit
9d9b7b4
<9d9b7b4>.
So that in the end, it looks like one commit that does the "right" thing
from the start.
Also also, to fix up a PR, you don't need to close it and open a new one,
like you did with #369 <#369>, #370
<#370> and #371
<#371>. Instead, force-push to your
remote branch that you used to base the PR off of. That will update the PR.
Okay, I'll see if I can figure it out.
Thank you.
…On Sun, Sep 23, 2018 at 6:17 AM, Sven Hesse ***@***.***> wrote:
Huh. So our Trigger class is wrong? Good to know. Thanks for finding this!
:)
I don't want to merge failing tests, but this would be a good starting
point to fix the code. Can you fix it, and add that to this PR? And move
the fixing commits before the test.
Also: c9b976c
<c9b976c>,
b64b62f
<b64b62f>
and 0e8ee66
<0e8ee66>
shouldn't be their own commit, but they should be squashed into the commit
9d9b7b4
<9d9b7b4>.
So that in the end, it looks like one commit that does the "right" thing
from the start.
Also also, to fix up a PR, you don't need to close it and open a new one,
like you did with #369 <#369>, #370
<#370> and #371
<#371>. Instead, force-push to your
remote branch that you used to base the PR off of. That will update the PR.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#372 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ApFfrIL88CAxMiDgB5uVSKhsVffdZVMtks5ud4oBgaJpZM4W1gso>
.
--
Bob
"A fish rots from the head down"
-- Ancient proverb
|
You can do that with an interactive rebase. I.e. "git rebase -i", and the commit ID of the point where you're starting modifying the history. Each line there is a single commit, if you move it up and down the stack, you're reordering the commits. If they touch different files/code, that should work cleanly. Otherwise, you'll have to manually fix up each conflict, and that's sometimes a bit hairy. |
This is a rare case but is built into the unit test. With this fix all unit tests pass for trigger.cpp.
I've updated src/engines/aurora/trigger.cpp to work properly with an updated unit test and revised the commit history accordingly. The revision was force pushed to rjshae/xoreos and I can see the commits there, but this pull request hasn't updated. Any suggestions? |
You pushed into the wrong branch: |
Well crud. Face palm. Okay, thank you.
…On Mon, Sep 24, 2018 at 10:07 PM, Sven Hesse ***@***.***> wrote:
You pushed into the wrong branch:
https://github.com/rjshae/xoreos/commits/xoreos
https://github.com/rjshae/xoreos/commits/master
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#372 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ApFfrHTzwLGu3VR14b_4OCIPmOzNo-Owks5uebn4gaJpZM4W1gso>
.
--
Bob
"A fish rots from the head down"
-- Ancient proverb
|
cd89ffd
to
a58e601
Compare
I just fixed up the include file spacing. |
This revision (slightly) improves the performance of the ray-casting algorithm by precomputing the slopes of the trigger polygon sides.
This test will pass an array of points to a utility Trigger class that define a close, non-convex polygon. The class' 'contains(float x, float y)' function is called for a set of test points. If the function is working properly, it will return the expected boolean result declared in the test. See the tests/engines/trigger.cpp comments for illustrations.
Merged as 29ce633...cda3687, thanks! :) |
This test defines a utility Trigger class that can accept an array of points in
X-Y-Z space. These are pushed onto the classes' _geometry vector for use with
the contains(float x, float y) function.
Each test provides a static array of points to the class that define a non-convex,
closed polygon -- equivalent to an in-game trigger region. The class contains
function is then passed a series of test points, and the output is compared to
the expected results.
For clarity, in tests/engines/trigger.cpp the comments for each test include an
ASCII illustration demonstrating the shape of the polygon and the location of
the test points.