Skip to content
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

Implementation of Plane integration tests #295

Merged
merged 2 commits into from
Jun 17, 2023
Merged

Conversation

T4rmyn
Copy link
Contributor

@T4rmyn T4rmyn commented Jun 4, 2023

Adds integration tests to the re-implemented Plane functions (#268, and fixing a function in it) and should also address the Plane section of issue #209.

This PR is also a recreation of #286 since it has the great error of force-pushing after rebasing.

@T4rmyn
Copy link
Contributor Author

T4rmyn commented Jun 4, 2023

Also thinking back I could have probably force-push the current state to the old PR that makes the commit log gone but well, it's too late.

Also sorry about the probable notifs and the general mess the old PR has generated (I don't know how the Github notification system works but it probably sends them).

Regarding the new changes since the last good commit of the old PR, the itest now works with ./check.sh --double.

@GodotRust
Copy link

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-295

@Bromeon Bromeon added feature Adds functionality to the library c: core Core components labels Jun 6, 2023
Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! Added some feedback.

@@ -217,7 +217,14 @@ impl Plane {
/// Returns a normalized copy of the plane.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't part of the changeset, but that doc line is really not helpful, as it contains exactly the information of the method and nothing more.

Since you also fixed the implementation, could you maybe describe more precisely what "normalization" in this context means?

Comment on lines 18 to 19
Plane::new(Vector3::UP.normalized(), 0.0),
Plane::new(Vector3::BACK.normalized(), 0.0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These vectors are unit vectors, no need for normalized().

Comment on lines 15 to 16
#[itest]
fn plane_equiv() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have one epic #[itest] of 150 LoC 🙂

Could you extract the local functions to a global level, and maybe split this into multiple #[itest] depending on what you check? That way, tests can succeed/fail independently, and it's easier to detect regressions. Each test also becomes easier to inspect if there is less code.

Copy link
Contributor Author

@T4rmyn T4rmyn Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be sufficient for just grouped #[itest]s or should every method be given its own #[itest]?

Also, I think issue is also present in rect2i's itest (it's where I got the epic #[itest] from 😄).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no very strict rule. You can group them if things are closely related (e.g. multiple "overloads" or set/get pairs, etc). Otherwise, use multiple ones.

Comment on lines 10 to 13
use godot::{
prelude::{inner::InnerPlane, real, Plane, RealConv, ToVariant, Vector3},
private::class_macros::assert_eq_approx,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick, please use separate lines for use statements without { } nesting.

Also, would be nice to import symbols from their original module, not the prelude.

@Bromeon
Copy link
Member

Bromeon commented Jun 6, 2023

bors try

bors bot added a commit that referenced this pull request Jun 6, 2023
@bors
Copy link
Contributor

bors bot commented Jun 6, 2023

try

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@T4rmyn
Copy link
Contributor Author

T4rmyn commented Jun 7, 2023

Thanks for reviewing! I'll try sort these out.

@T4rmyn T4rmyn force-pushed the itest_plane branch 4 times, most recently from bd20d8f to 67178be Compare June 15, 2023 15:12
@T4rmyn
Copy link
Contributor Author

T4rmyn commented Jun 15, 2023

For these changes, the itests have been split so each method their own itest. Also, for methods that have two types of results (negative or positive, true or false, etc...) I included two tests and only one for methods that have only one type of result.

@T4rmyn T4rmyn requested a review from Bromeon June 15, 2023 15:24
Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

bors r+

bors bot added a commit that referenced this pull request Jun 17, 2023
295: Implementation of Plane integration tests r=Bromeon a=T4rmin

Adds integration tests to the re-implemented Plane functions (#268, and fixing a function in it) and should also address the Plane section of issue #209.

This PR is also a recreation of #286 since it has the great error of force-pushing after rebasing.


Co-authored-by: Aaron Lawrence <t4rmin@protonmail.com>
@bors
Copy link
Contributor

bors bot commented Jun 17, 2023

Build failed:

@Bromeon
Copy link
Member

Bromeon commented Jun 17, 2023

bors retry

@bors
Copy link
Contributor

bors bot commented Jun 17, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 6608393 into godot-rust:master Jun 17, 2023
@T4rmyn T4rmyn deleted the itest_plane branch June 17, 2023 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: core Core components feature Adds functionality to the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants