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 for using components as keys in map #522

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

christopher-davis-afs
Copy link
Contributor

Describe your changes

These tests help us understand how components are
found in e.g. DeviceModelMap.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

@christopher-davis-afs
Copy link
Contributor Author

CC @shankari

These tests help us understand how components are
found in e.g. DeviceModelMap.

Co-authored-by: Gianfranco Berardi <[email protected]>
Signed-off-by: Christopher Davis <[email protected]>
@christopher-davis-afs christopher-davis-afs force-pushed the cdavis/add-devicemodel-unit-tests branch from 2ccc8dd to 4e39cda Compare March 11, 2024 14:30
Copy link
Contributor

@marcemmers marcemmers left a comment

Choose a reason for hiding this comment

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

Looks good, just wondering about a small thing we might want to look at.

.name = "Bar",
};

EXPECT_EQ(components_to_ints.find(base_comp)->second, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

What would happen here if base_comp could not be found in the map?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the component isn't found and we access ->second without checking, it would be undefined behavior from what I understand. Here in the test I don't check because base_comp is in the map.

@Pietfried Pietfried merged commit c19299e into EVerest:main Mar 15, 2024
4 checks passed
@christopher-davis-afs christopher-davis-afs deleted the cdavis/add-devicemodel-unit-tests branch April 29, 2024 15:24
@drmrd
Copy link
Collaborator

drmrd commented May 2, 2024

Contributes to #361

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.

4 participants