epiverse-trace / epichains

[Under active development] Methods for simulating and analysing the sizes and lengths of infectious disease transmission chains from branching process models
https://epiverse-trace.github.io/epichains/
Other
5 stars 2 forks source link

Make `switch()` statements error when there's no match #205

Closed jamesmbaazam closed 7 months ago

jamesmbaazam commented 7 months ago

A failsafe to prevent bugs.

The helper functions .update_chain_stat() and .get_statistic_func() used switch() statements that did not error if there was no match. In fact, switch() statements return NULL if there is no match, which could potentially cause bugs downstream. However, the current state of the code is fine because in the function that it is called, the argument passed to it is matched at the top, and errors there.

The functions will now error when there is no match instead of returning NULL, which could cause bugs.

No.

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (00d337d) 98.90% compared to head (9881e08) 98.90%.

:exclamation: Current head 9881e08 differs from pull request most recent head 06ced1b. Consider uploading reports for the commit 06ced1b to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #205 +/- ## ======================================= Coverage 98.90% 98.90% ======================================= Files 8 8 Lines 548 550 +2 ======================================= + Hits 542 544 +2 Misses 6 6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.