-
Notifications
You must be signed in to change notification settings - Fork 0
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 some tests #17
add some tests #17
Conversation
expect_vector(output, ptype = integer()) | ||
expect_length(output, time_horizon + 1) | ||
expect_contains(output, market_share_target_reference_year) | ||
expect_length(output, length(unique(output))) |
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.
For this one, I think having an explicit expect_identical
is a good idea, since these checks aren't looking for continuity, or max/min value (having a 2040
sneak in somehow).
expect_length(output, length(unique(output))) | |
expect_length(output, length(unique(output))) | |
expect_identical(output, c(2023L, 2024L, 2025L, 2026L, 2027L, 2028L)) |
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.
since the input values are parameterized, I'd rather it be
expect_length(output, length(unique(output))) | |
expect_length(output, length(unique(output))) | |
expect_identical(output, market_share_target_reference_year: (market_share_target_reference_year + time_horizon)) |
but that's basically replicating the function 🤣
market_share_target_reference_year:(market_share_target_reference_year + time_horizon) |
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.
then the test should definitely pass XD
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.
But the input values aren't parameterized in the test... That's the point of the test.
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.
expect_identical(
determine_relevant_years(market_share_target_reference_year, time_horizon),
determine_relevant_years(market_share_target_reference_year, time_horizon)
)
🚀
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.
they are parameterized in the test, see line 2 and 3... for easy future testing of other possibilities/combinations
No description provided.