Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edelarua committed Aug 28, 2024
1 parent 58d6440 commit 7b62eb3
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 26 deletions.
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ reference:

- title: "Helpers"
- contents:
- boot_ci
- proportion_ci
- construction_helpers
111 changes: 90 additions & 21 deletions tests/testthat/_snaps/boot_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,97 @@

Code
res
Message
{cards} data frame: 16 x 8
Output
variable context stat_name stat_label stat warning
1 AGE continuo… N N 254 bootstra…
2 AGE continuo… estimate estimate 75.087 bootstra…
3 AGE continuo… conf.level conf.lev… 0.95 bootstra…
4 AGE continuo… R R 2000 bootstra…
5 AGE continuo… ci.type.1 ci.type.1 normal bootstra…
6 AGE continuo… conf.low.1 conf.low… 74.081 bootstra…
7 AGE continuo… conf.high.1 conf.hig… 76.11 bootstra…
8 AGE continuo… ci.type.2 ci.type.2 basic bootstra…
9 AGE continuo… conf.low.2 conf.low… 74.114 bootstra…
10 AGE continuo… conf.high.2 conf.hig… 76.153 bootstra…
11 AGE continuo… ci.type.3 ci.type.3 percent bootstra…
12 AGE continuo… conf.low.3 conf.low… 74.02 bootstra…
13 AGE continuo… conf.high.3 conf.hig… 76.059 bootstra…
14 AGE continuo… ci.type.4 ci.type.4 bca bootstra…
15 AGE continuo… conf.low.4 conf.low… 73.992 bootstra…
16 AGE continuo… conf.high.4 conf.hig… 76.04 bootstra…
Message
i 2 more variables: fmt_fn, error
$N
[1] 254
$estimate
[1] 75.08661
$conf.level
[1] 0.95
$R
[1] 2000
$ci.type.1
[1] "normal"
$conf.low.1
[1] 74.08126
$conf.high.1
[1] 76.11047
$ci.type.2
[1] "basic"
$conf.low.2
[1] 74.11417
$conf.high.2
[1] 76.15325
$ci.type.3
[1] "percent"
$conf.low.3
[1] 74.01998
$conf.high.3
[1] 76.05906
$ci.type.4
[1] "bca"

---

Code
res
Output
$N
[1] 254
$estimate
[1] 75.08661
$conf.level
[1] 0.95
$R
[1] 2000
$ci.type.1
[1] "normal"
$conf.low.1
[1] 74.08126
$conf.high.1
[1] 76.11047
$ci.type.2
[1] "basic"
$conf.low.2
[1] 74.11417
$conf.high.2
[1] 76.15325
$ci.type.3
[1] "percent"
$conf.low.3
[1] 74.01998
$conf.high.3
[1] 76.05906
$ci.type.4
[1] "bca"

# boot_ci() warnings work

Expand Down
7 changes: 2 additions & 5 deletions tests/testthat/test-boot_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ test_that("boot_ci() works with standard use", {
expect_snapshot(res)

set.seed(1)
res <- cards::ADSL |>
cards::ard_continuous(
variables = AGE,
statistic = everything() ~ list(boot_ci = boot_ci)
)
expect_warning(res <- boot_ci(x, type = "all")[1:14])
expect_snapshot(res)

expect_snapshot(res)
})
Expand Down

0 comments on commit 7b62eb3

Please sign in to comment.