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

Rename testthat files #571

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions tests/testthat/test-data-object.R

This file was deleted.

46 changes: 46 additions & 0 deletions tests/testthat/test-fimsframe.R
kellijohnson-NOAA marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,49 @@ test_that("Validators work as expected", {
bad_input <- data.frame(test = 1, test2 = 2)
expect_warning(expect_error(FIMSFrame(bad_input)))
})

nyears <- age_frame@nyrs
nages <- max(age_frame@ages)

fleet_names_agecomp <- dplyr::filter(
.data = as.data.frame(age_frame@data),
type == "age"
) %>%
dplyr::distinct(name) %>%
dplyr::pull(name)
nagecomp <- length(fleet_names_agecomp)

fleet_names_index <- dplyr::filter(
.data = as.data.frame(age_frame@data),
type == "index"
) %>%
dplyr::distinct(name) %>%
dplyr::pull(name)
nindex <- length(fleet_names_index)

test_that("Can add index data to model", {
indexdat <- vector(mode = "list", length = nindex)
names(indexdat) <- fleet_names_index

for (index_i in 1:nindex) {
index <- Index
indexdat[[fleet_names_index[index_i]]] <- new(index, nyears)
expect_silent(indexdat[[fleet_names_index[index_i]]] <-
m_index(age_frame, fleet_names_index[index_i]))
}

clear()
})

test_that("Can add agecomp data to model", {
agecompdat <- vector(mode = "list", length = nagecomp)
names(agecompdat) <- fleet_names_agecomp

for (fleet_f in 1:nagecomp) {
agecompdat[[fleet_names_agecomp[fleet_f]]] <- new(AgeComp, nyears, nages)
expect_silent(agecompdat[[fleet_names_agecomp[fleet_f]]]$age_comp_data <-
m_agecomp(age_frame, fleet_names_agecomp[fleet_f]))
}

clear()
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading