-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rory Nolan
committed
Dec 29, 2024
1 parent
c70e9de
commit 0d4539f
Showing
7 changed files
with
185 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ src/*.so | |
src/*.dll | ||
inst/doc | ||
docs/ | ||
tools/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
test_that("NA handling in frame stats works", { | ||
# Create test array with all NAs | ||
all_na_arr <- array(NA_real_, dim = c(2, 2, 2)) | ||
|
||
# Test sum_frames_na_omit | ||
expect_true(all(is.na(dbl_sum_frames_na_omit(all_na_arr)))) | ||
expect_true(all(is.na(int_sum_frames_na_omit(array(NA_integer_, dim = c(2, 2, 2)))))) | ||
|
||
# Test mean_frames_na_omit | ||
expect_true(all(is.na(dbl_mean_frames_na_omit(all_na_arr)))) | ||
expect_true(all(is.na(int_mean_frames_na_omit(array(NA_integer_, dim = c(2, 2, 2)))))) | ||
|
||
# Create test array with mix of values and NAs | ||
mixed_arr <- array(c(1, NA, 3, NA, 5, NA, 7, NA), dim = c(2, 2, 2)) | ||
|
||
# Test sum_frames_na_omit with mixed data | ||
sums <- dbl_sum_frames_na_omit(mixed_arr) | ||
expect_equal(sums[1], 4) # 1 + 3 | ||
expect_equal(sums[2], 12) # 5 + 7 | ||
|
||
# Test mean_frames_na_omit with mixed data | ||
means <- dbl_mean_frames_na_omit(mixed_arr) | ||
expect_equal(means[1], 2) # (1 + 3) / 2 | ||
expect_equal(means[2], 6) # (5 + 7) / 2 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters