Skip to content

Commit c66a21b

Browse files
committed
fixed unit tests
1 parent 8af2060 commit c66a21b

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

tests/testthat/test-disc-meanDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set.standard.disclosure.settings()
2525
test_that("numeric meanDS, with below nfilter.tab values", {
2626
input <- c(NA, NA, 2.0, NA, 4.0)
2727

28-
expect_error(meanDS(input), "FAILED: Nvalid less than nfilter.tab", fixed = TRUE)
28+
expect_error(meanDS("input"), "FAILED: Nvalid less than nfilter.tab", fixed = TRUE)
2929
})
3030

3131
#

tests/testthat/test-disc-varDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set.standard.disclosure.settings()
2525
test_that("numeric varDS, with below nfilter.tab values", {
2626
input <- c(NA, NA, 2.0, NA, 4.0)
2727

28-
expect_error(varDS(input), "FAILED: Nvalid less than nfilter.tab", fixed = TRUE)
28+
expect_error(varDS("input"), "FAILED: Nvalid less than nfilter.tab", fixed = TRUE)
2929
})
3030

3131
#

tests/testthat/test-perf-meanDS.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test_that("numeric meanDS - performance", {
3636
.current.time <- .start.time
3737

3838
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
39-
meanDS(input)
39+
meanDS("input")
4040

4141
.count <- .count + 1
4242
.current.time <- Sys.time()
@@ -71,7 +71,7 @@ test_that("numeric meanDS, with NA - performance", {
7171
.current.time <- .start.time
7272

7373
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
74-
meanDS(input)
74+
meanDS("input")
7575

7676
.count <- .count + 1
7777
.current.time <- Sys.time()

tests/testthat/test-perf-varDS.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test_that("numeric varDS - performance", {
3636
.current.time <- .start.time
3737

3838
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
39-
varDS(input)
39+
varDS("input")
4040

4141
.count <- .count + 1
4242
.current.time <- Sys.time()
@@ -71,7 +71,7 @@ test_that("numeric varDS, with NA - performance", {
7171
.current.time <- .start.time
7272

7373
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
74-
varDS(input)
74+
varDS("input")
7575

7676
.count <- .count + 1
7777
.current.time <- Sys.time()

tests/testthat/test-smk-meanDS.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ test_that("numeric meanDS, with NA", {
6363

6464
# context("meanDS::smk::numeric with all NA")
6565
test_that("numeric meanDS, with all NA", {
66-
input <- c(NA, NA, NA, NA, NA)
67-
66+
input <- rep(NA_real_, 5)
67+
6868
res <- meanDS("input")
6969

7070
expect_length(res, 5)

tests/testthat/test-smk-meanSdGpDS.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ test_that("simple meanSdGpDS, numeric by factor", {
3333
expect_equal(res$Nvalid, 10)
3434
expect_equal(res$Nmissing, 0)
3535
expect_equal(res$Ntotal, 10)
36-
expect_equal(res$Mean_gp[["A"]], 3.0)
37-
expect_equal(res$Mean_gp[["B"]], 8.0)
36+
expect_equal(as.numeric(res$Mean_gp)[1], 3.0)
37+
expect_equal(as.numeric(res$Mean_gp)[2], 8.0)
3838
})
3939

4040
test_that("meanSdGpDS throws error when X does not exist", {

tests/testthat/test-smk-varDS.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ test_that("numeric varDS, with NA", {
6767

6868
# context("varDS::smk::numeric with all NA")
6969
test_that("numeric varDS, with all NA", {
70-
input <- c(NA, NA, NA, NA, NA)
71-
70+
input <- rep(NA_real_, 5)
71+
7272
res <- varDS("input")
73-
73+
7474
expect_length(res, 6)
7575
expect_equal(class(res), "list")
76-
expect_equal(class(res$Sum), "integer")
76+
expect_equal(class(res$Sum), "numeric")
7777
expect_equal(res$Sum, 0)
7878
expect_equal(class(res$SumOfSquares), "numeric")
7979
expect_equal(res$SumOfSquares, 0)

0 commit comments

Comments
 (0)