diff --git a/tests/testthat/test-serp.R b/tests/testthat/test-serp.R index fbe5b3932..9d63cef40 100644 --- a/tests/testthat/test-serp.R +++ b/tests/testthat/test-serp.R @@ -28,6 +28,45 @@ test_that("get_df", { }) +test_that("get_modelmatrix", { + expect_identical( + get_modelmatrix(m1), + structure( + c( + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 1, 1, 1, 1, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, + 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, + 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, + 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, + 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, + 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 + ), + dim = c(72L, 3L), + dimnames = list( + c( + "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", + "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", + "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", + "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", + "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", + "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", + "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", + "72" + ), + c("(Intercept)", "tempwarm", "contactyes") + ), + assign = 0:2, + contrasts = list(temp = "contr.treatment", contact = "contr.treatment") + ), + ignore_attr = TRUE + ) +}) + + test_that("find_predictors", { expect_identical(find_predictors(m1), list(conditional = c("temp", "contact"))) expect_identical(find_predictors(m1, flatten = TRUE), c("temp", "contact"))