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 some tests #17

Merged
merged 2 commits into from
Apr 16, 2024
Merged

add some tests #17

merged 2 commits into from
Apr 16, 2024

Conversation

cjyetman
Copy link
Member

No description provided.

@cjyetman cjyetman requested a review from jdhoffa April 16, 2024 12:54
AlexAxthelm
AlexAxthelm previously approved these changes Apr 16, 2024
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)))

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).

Suggested change
expect_length(output, length(unique(output)))
expect_length(output, length(unique(output)))
expect_identical(output, c(2023L, 2024L, 2025L, 2026L, 2027L, 2028L))

Copy link
Member Author

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

Suggested change
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)

Copy link
Member

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

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.

Copy link
Member Author

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)
)

🚀

Copy link
Member Author

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

jdhoffa
jdhoffa previously approved these changes Apr 16, 2024
@cjyetman cjyetman dismissed stale reviews from jdhoffa and AlexAxthelm via 64fdb04 April 16, 2024 14:06
@cjyetman cjyetman merged commit 748d7c9 into main Apr 16, 2024
7 checks passed
@cjyetman cjyetman deleted the add-some-test branch April 16, 2024 14:22
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.

3 participants