File tree Expand file tree Collapse file tree 4 files changed +39
-3
lines changed
Expand file tree Collapse file tree 4 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 11# admiralneuro (development version)
22
3- ## Updates of Existing Functions
3+ ## Updates of Existing Functions
44
55- Improved test coverage in ` compute_centiloid() ` function when invalid tracer combination is provided. (#106 )
66## New features
Original file line number Diff line number Diff line change 3333# '
3434# ' @param suvr SUVR value
3535# '
36- # ' A numeric value is expected.
36+ # ' A positive numeric value is expected.
3737# '
3838# ' @permitted [num_scalar]
3939# '
@@ -136,6 +136,11 @@ compute_centiloid <- function(
136136 custom_slope = NULL ,
137137 custom_intercept = NULL
138138) {
139+ # Validation check SUVR must be positive
140+ if (suvr < = 0 ) {
141+ cli :: cli_abort(" {.arg suvr} must be a positive numeric value (received {.val {suvr}})." )
142+ }
143+
139144 # Check custom_slope and custom_intercept
140145 has_custom_slope <- ! is.null(custom_slope )
141146 has_custom_intercept <- ! is.null(custom_intercept )
Original file line number Diff line number Diff line change 4949 * pipeline = "AVID FBB SUVR PIPELINE"
5050 * ref_region = "Whole Cerebellum"
5151
52+ # Test 16 compute_centiloid throws error for non-positive SUVR values
53+
54+ `suvr` must be a positive numeric value (received 0).
55+
56+ ---
57+
58+ `suvr` must be a positive numeric value (received -1.5).
59+
Original file line number Diff line number Diff line change @@ -207,7 +207,30 @@ test_that("Test 15 compute_centiloid() throws the expected error message when no
207207 compute_centiloid(
208208 tracer = " 18F-Florbetapir" ,
209209 pipeline = " AVID FBB SUVR PIPELINE" ,
210- ref_region = " Whole Cerebellum"
210+ ref_region = " Whole Cerebellum" ,
211+ suvr = 1.25
212+ )
213+ )
214+ })
215+
216+ test_that(" Test 16 compute_centiloid throws error for non-positive SUVR values" , {
217+ # Test with zero
218+ expect_snapshot_error(
219+ compute_centiloid(
220+ tracer = " 18F-Florbetapir" ,
221+ pipeline = " AVID FBP SUVR PIPELINE" ,
222+ ref_region = " Whole Cerebellum" ,
223+ suvr = 0
224+ )
225+ )
226+
227+ # Test with negative value
228+ expect_snapshot_error(
229+ compute_centiloid(
230+ tracer = " 18F-Florbetapir" ,
231+ pipeline = " AVID FBP SUVR PIPELINE" ,
232+ ref_region = " Whole Cerebellum" ,
233+ suvr = - 1.5
211234 )
212235 )
213236})
You can’t perform that action at this time.
0 commit comments