Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

Addresses the tracking issue to ensure every documented behavior is tested and every tested behavior is documented for exported functions.

Changes

Enhanced test coverage (+305 lines across 4 files):

  • animateSpectra: 1→11 tests covering all parameters (species filtering, time_range vectors, wlim/ylim with NA handling, power values 0/1/2/custom, total/resource flags, input validation)

  • Predation kernels: Enhanced box_pred_kernel boundary conditions and parameter validation; added tests for lognormal_pred_kernel (peak location, ppmr<1 zeros), truncated_lognormal_pred_kernel (truncation behavior), power_law_pred_kernel (sigmoidal cutoffs)

  • Reproduction functions: Added BevertonHoltRDD R_max validation, constantRDD/noRDD basic tests

  • Distance functions: Added distanceMaxRelRDI and distanceSSLogN tests (non-negativity, zero-distance identity, zero-abundance handling)

  • Helper functions: Added constant_other test

Verified adequate coverage for 20+ functions including compareParams, selectivity functions, size bins (w/dw/w_full/dw_full), getters (get__default), validators (valid, validParams), and resource dynamics.

All tests follow existing testthat patterns and use established fixtures (NS_params).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R --no-echo --no-restore -e .libPaths(&#39;~/R/library&#39;);~&#43;~install.packages(&#39;devtools&#39;,~&#43;~repos=&#39;REDACTED&#39;,~&#43;~Ncpus=4) (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Check for all functions that documentation and tests agree</issue_title>
<issue_description>Every aspect of a function that is documented should be tested. That way we will never break things unexpectedly that the user has a right to expect will work. I expect that we will need to add a lot more tests.

Conversely, if a behaviour is being tested, then that behaviour should be something the reader of the documentation will expect. I suspect that while looking over the tests we will get ideas of how to clarify the documentation.

Here is an alphabetical list of currently exported functions, so that we can check off any where we are happy with both documentation and tests.

  • addSpecies
  • animateSpectra
  • BevertonHoltRDD
  • box_pred_kernel
  • compareParams
  • constant_other
  • constantEggRDI
  • constantRDD
  • customFunction
  • default_pred_kernel_params
  • distanceMaxRelRDI
  • distanceSSLogN
  • double_sigmoid_length
  • dw
  • dw_full
  • emptyParams
  • finalN
  • finalNOther
  • finalNResource
  • gear_params
  • get_f0_default
  • get_gamma_default
  • get_h_default
  • get_initial_n
  • get_ks_default
  • get_phi
  • get_size_range_array
  • get_time_elements
  • getBiomass
  • getCatchability
  • getColours
  • getCommunitySlope
  • getComponent
  • getCriticalFeedingLevel
  • getDiet
  • getEffort
  • getEGrowth
  • getEncounter
  • getERepro
  • getEReproAndGrowth
  • getESpawning
  • getExtMort
  • getFeedingLevel
  • getFMort
  • getFMortGear
  • getGrowthCurves
  • getInitialEffort
  • getInteraction
  • getLinetypes
  • getM2
  • getM2Background
  • getMaturityProportion
  • getMaxIntakeRate
  • getMeanMaxWeight
  • getMeanWeight
  • getMetabolicRate
  • getMort
  • getN
  • getParams
  • getPhiPrey
  • getPredKernel
  • getPredMort
  • getPredRate
  • getProportionOfLargeFish
  • getRateFunction
  • getRates
  • getRDD
  • getRDI
  • getReproductionLevel
  • getReproductionProportion
  • getResourceCapacity
  • getResourceDynamics
  • getResourceMort
  • getResourceRate
  • getSearchVolume
  • getSelectivity
  • getSSB
  • getTimes
  • getYield
  • getYieldGear
  • getZ
  • idxFinalT
  • initialN
  • initialNOther
  • initialNResource
  • knife_edge
  • log_breaks
  • lognormal_pred_kernel
  • melt
  • mizerEGrowth
  • mizerEncounter
  • mizerERepro
  • mizerEReproAndGrowth
  • mizerFeedingLevel
  • mizerFMort
  • mizerFMortGear
  • mizerMort
  • MizerParams
  • mizerPredMort
  • mizerPredRate
  • mizerRates
  • mizerRDI
  • mizerResourceMort
  • MizerSim
  • N
  • newCommunityParams
  • newMultispeciesParams
  • newSingleSpeciesParams
  • newTraitParams
  • noRDD
  • NOther
  • NResource
  • other_params
  • plotBiomass
  • plotDataFrame
  • plotDiet
  • plotFeedingLevel
  • plotFMort
  • plotGrowthCurves
  • plotlyBiomass
  • plotlyFeedingLevel
  • plotlyFMort
  • plotlyGrowthCurves
  • plotlyPredMort
  • plotlySpectra
  • plotlyYield
  • plotlyYieldGear
  • plotM2
  • plotPredMort
  • plotSpectra
  • plotYield
  • plotYieldGear
  • power_law_pred_kernel
  • project
  • project_simple
  • projectToSteady
  • removeComponent
  • removeSpecies
  • renameSpecies
  • resource_constant
  • resource_params
  • resource_semichemostat
  • RickerRDD
  • set_community_model
  • set_multispecies_model
  • set_species_param_default
  • set_trait_model
  • setBevertonHolt
  • setColours
  • setComponent
  • setExtMort
  • setFishing
  • setInitialValues
  • setInteraction
  • setLinetypes
  • setMaxIntakeRate
  • setMetabolicRate
  • setParams
  • setPredKernel
  • setRateFunction
  • setReproduction
  • setResource
  • setRmax
  • setSearchVolume
  • SheperdRDD
  • sigmoid_length
  • sigmoid_weight
  • species_params
  • steady
  • truncated_lognormal_pred_kernel
  • upgradeParams
  • upgradeSim
  • valid_species_arg
  • validEffortVector
  • validGearParams
  • validParams
  • validSpeciesParams
  • w
  • w_full
    </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add tests to ensure function documentation consistency Add comprehensive test coverage for underdocumented exported functions Nov 16, 2025
Copilot AI requested a review from gustavdelius November 16, 2025 11:11
@gustavdelius gustavdelius marked this pull request as ready for review November 16, 2025 12:04
@gustavdelius gustavdelius merged commit a531581 into master Nov 16, 2025
0 of 5 checks passed
@gustavdelius gustavdelius deleted the copilot/check-function-docs-tests branch November 16, 2025 12:04
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.

Check for all functions that documentation and tests agree

2 participants