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

Add tests file for Quaternion unit tests, with initial UTs #50907

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

codepatzer
Copy link
Contributor

@codepatzer codepatzer commented Jul 26, 2021

  • Test constructors and quaternion product.
  • Add test case for Axis-Angle construction about Y-axis.
  • Add test case for xform of i-, j-, & k-unit vectors.
  • Add test case for construction from Basis.
  • Add test case for xform of arbitrary vector.
  • Add stress test case: many Quaternions xform many vectors.
  • Make comments consistent with style guide.

@codepatzer codepatzer requested a review from a team as a code owner July 26, 2021 18:07
@Calinou Calinou added this to the 4.0 milestone Jul 26, 2021
@fire
Copy link
Member

fire commented Jul 27, 2021

@codepatzer
Copy link
Contributor Author

@codepatzer I have enabled cicd checks.

Notes:

* https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html

* https://docs.godotengine.org/en/stable/community/contributing/testing_pull_requests.html

Thanks for kicking off the checks! And thanks very much for the links. I see that I have not been following the process quite as the project lays it out. I will mend my ways in future, or at least move on to a new set of mistakes.

@codepatzer
Copy link
Contributor Author

Rebased to have a single commit after checks passed, following a half dozen separate commits.

@codepatzer
Copy link
Contributor Author

Rebased onto current upstream master branch.

tests/test_quaternion.h Outdated Show resolved Hide resolved
tests/test_quaternion.h Outdated Show resolved Hide resolved
tests/test_quaternion.h Outdated Show resolved Hide resolved
@akien-mga
Copy link
Member

Sorry for the late review. @codepatzer Are you available to rebase this PR and squash the commits? The test should also be moved to tests/core/math/test_quaternion.h.

- Test constructors and quaternion product.
- Add test case for Axis-Angle construction about Y-axis.
- Add test case for xform of i-, j-, & k-unit vectors.
- Add test case for construction from Basis.
- Add test case for xform of arbitrary vector.
- Add stress test case: many Quaternions xform many vectors.
- Make comments consistent with style guide.
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Apologies for the delay reviewing this.

The tests look great! I force pushed an update to rebase and squash the commits, and did a few minor changes:

  • Removed usage of M_PI and redefinition of deg2rad: we have all this already in core/math/math_defs.h and core/math/math_funcs.h so you just need to use those.
  • Fix build issue for "Construct Basis Axes" since get_axis was renamed to get_column.
  • The comment there about not being able to construct Basis from vectors may no longer be true, as there is a Basis(const Vector3 &row0, const Vector3 &row1, const Vector3 &row2) constructor. It's rows and not columns so might not be directly useful here though. I left it as is for now, could be revisited in a follow up PR.

@akien-mga akien-mga merged commit 426240f into godotengine:master Aug 4, 2022
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants