-
Notifications
You must be signed in to change notification settings - Fork 1
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
Create unit tests for fullness #42
Conversation
… are not implemented in this branch. this is based off of them theoretically being in our codebase. Co-authored-by: Lily Johnson <41386414+lilyjohnson@users.noreply.github.com>
… class Co-authored-by: Lily Johnson <41386414+lilyjohnson@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More meaningful tests needed to be added in the future, but we can just merge this once these changes are made
void test_can_construct_mock_distance_sensor() | ||
{ | ||
Fullness::MockDistance mockDistanceSensor({3, -6, 27, 114, 9}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
void test_returns_correct_fullness() | ||
{ | ||
uint32_t binHeight = 10; | ||
int32_t calculatedAverageDistance = 5; // should be 5.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a float
Fullness::MockDistance mockDistanceSensor(distances); | ||
|
||
Fullness::FullnessMetric mockFullness(binHeight, mockDistanceSensor); | ||
TEST_ASSERT_EQUAL_INT(calculatedAverageDistance, (mockFullness.getFullness())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getFullness() returns a float
uint32_t binHeight = 10; | ||
int32_t calculatedAverageDistance = 5; // should be 5.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these const
lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm now
Description
Created unit tests using the Mock Distance Sensor and the Fullness Class. Checked if mock distance sensor can be constructed, that it returns the correct distance, that it can loop through the distances, and that the Fullness class returns the correct fullness and if it can recognize if a distance is valid.
Type of change
Testing and Verification Instructions
Checklist: