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

Test suite and overall updates #73

Open
barrettk opened this issue Oct 22, 2024 · 0 comments
Open

Test suite and overall updates #73

barrettk opened this issue Oct 22, 2024 · 0 comments

Comments

@barrettk
Copy link
Contributor

#67 does some restructuring related to this issue title within the scope of the bootstrap related functions, their counter parameter functions (e.g., define_boot_table vs define_param_table), and a couple nested helper functions. However there is a strong need to update and redefine some of the tests in this package, along with making the documentation a bit more clear in a few cases.

Tests

  • setup.R and code snippets above tests (top of a script) need to be better organized so it's clear which variables come from outside of a given test.
    • I think we can (and should) remove the variables defined at the top of tests in most cases (they should be done within a test in most cases)
  • Variable names in setup.R and individual tests could be better. E.g., paramEst vs nonbootEst, when in reality they are both the parameter estimates, just for different models. If we need to reference both, better names would be param_est_102 and param_est_106
  • There were cases where testing for a particular error wasn't being done properly. In the example below, we should be expecting a specific error (and not using capture.output), like expect_error(func(a,b), "Incorrect argument supplied"). I addressed some of these in #67, but in general I think we need to make sure we're properly capturing the expectation.
    test_that("define_boot_table incorrect input type: no parameter_names column",{
      boot_paramEst2 <- boot_paramEst
      colnames(boot_paramEst2)[colnames(boot_paramEst2) == "run"] ="no_name"
      # This line is problematic
      expect_error(capture.output(define_boot_table(boot_paramEst2, paramKey)))
    })
  • Tests like this should be done in a separate test file for loadParamKey. There is a duplicate one for define_boot_table. We really only need to write tests for functionality that this new function is responsible for (e.g., we dont need to test that digits are done right if just passed to pmtables::sig(). Integration tests can be fine, but there are redundancies in a few spots.

Misc recommendations

  • Function naming should be consistent, whether internal or exported. E.g., getCV_lognormO vs define_boot_table. IMO they should both use underscores and be all lower case moving forward, but I would want a second opinion here as to whether it makes sense to update existing internal functions.
  • Reduce the number of times system.file() is called. If most stem from a particular directory, call it once and make the other file paths relative to that one. This is needed for some examples as well.
@graceannobrien graceannobrien linked a pull request Oct 24, 2024 that will close this issue
@graceannobrien graceannobrien removed a link to a pull request Oct 24, 2024
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

No branches or pull requests

1 participant