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 unit tests #30

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

ianpetek
Copy link
Contributor

@ianpetek ianpetek commented Feb 5, 2023

No description provided.

@stribor14
Copy link
Collaborator

Merging is blocked until:

  • building tests is not a default option (i.e., build test must pass as-is, with only eigen3 as dependency)
  • add a new workflow which will test automatically (for all PRs and master branch)

@stribor14 stribor14 force-pushed the unit-tests branch 6 times, most recently from dcb2e77 to 86bfcb9 Compare September 20, 2024 09:23
@stribor14
Copy link
Collaborator

I pushed few commits to fix some workflow changes, and to acquire a knowledge of how it works

Copy link
Collaborator

@stribor14 stribor14 left a comment

Choose a reason for hiding this comment

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

Take this few comments into account, and go through rest of the file in same spirit

EXPECT_EQ(end_points_expected, point_curve) << "Curve end points differ from expected";
}

TEST_F(BezierTest, CurvePolylineTest)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of just blindly checking point-for-point (which can change in smallest details from commit to commit), it would be better to check with some algorithmic knowledge.

Here is the example for this function:

  • create 2 polylines with different parameters for flatness, and compare max deviation from default polyline (computed as root-mean-square-distance)


TEST_F(BezierTest, CurveEndPointsTest)
{
std::pair<Point, Point> end_points_expected{getCurvePointsAsPointVector().at(0),
Copy link
Collaborator

Choose a reason for hiding this comment

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

.at(0) -> .front()


TEST_F(BezierTest, CurveValueAtTest)
{
std::vector<double> t_vals{0., 0.25, 0.5, 0.75, 1};
Copy link
Collaborator

Choose a reason for hiding this comment

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

constexpr std::array t_vals{0., 0.25, 0.5, 0.75, 1};

Copy link
Collaborator

Choose a reason for hiding this comment

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

and for all other instances also

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

Successfully merging this pull request may close these issues.

2 participants