Skip to content

Add penalties testcases - #6

Open
VictorYanson wants to merge 3 commits into
Marco-Sola-Lab:mainfrom
VictorYanson:add-penalties-testcases
Open

VictorYanson wants to merge 3 commits into
Marco-Sola-Lab:mainfrom
VictorYanson:add-penalties-testcases

Conversation

@VictorYanson

Copy link
Copy Markdown

PR adds doctest test cases for penalties.h. I tried to approximately mimic the unit test structure for the other existing modules. Let me know if anything needs to be improved!

Summary
Check penalty members test case goes through all three penalty types and asserts expected member function outputs.

Note: I asked AI what argument values to pass to each penalty type. Beyond that, everything was handwritten.

@VictorYanson

Copy link
Copy Markdown
Author

Before merging: Would it be fitting to place the internal_penalty tests in this same file? If so, I will add them below the penalties.h tests. Additionally, if there’s any other test missing here for the Penalties class itself, I’ll be happy to include them in this PR as well.

Comment thread include/theseus/penalties.h Outdated
* @return The gap extension penalty if the gap type is dual affine.
* Otherwise, return 0.
*/
penalty_t gape2() const { return gape_; }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Let me know if this was intentional, if so, I’ll change it back

Comment thread .gitignore
tests/interactive/*

# Apple-specific
.DS_Store

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Just an annoying Apple thing

TEST_CASE("Check penalty members") {
SUBCASE("Linear") {
theseus::Penalties penalties(0, 1, 1);
CHECK(penalties.type() == theseus::Penalties::Linear);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is there a reason you always use CHECK assertions instead of the built in CHECK_EQUAL? Just curious

@VictorYanson

Copy link
Copy Markdown
Author

@albertjimenezbl let me know if this PR works for you. I'd love to contribute more, just wanna get this one done to understand if this kind of approach is what you're looking for

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.

1 participant