Skip to content

Commit 9b0e0de

Browse files
author
swheater
committed
Update for Armadillo
1 parent 0b2ace8 commit 9b0e0de

3 files changed

Lines changed: 54 additions & 32 deletions

File tree

tests/testthat/test-smk-ds.metadata.R

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,56 @@ context("ds.metadata::smk")
2828
test_that("data.frame metadata", {
2929
res <- ds.metadata(x='D')
3030

31-
expect_true(all(class(res) %in% c('list')))
32-
expect_length(res, 3)
33-
expect_length(res$sim1, 2)
34-
expect_true(all(class(res$sim1) %in% c('list')))
35-
expect_true(all(names(res$sim1) %in% c('names', 'spec', 'class')))
36-
expect_length(res$sim1$names, 11)
37-
expect_length(res$sim1$class, 1)
38-
expect_length(res$sim2, 2)
39-
expect_true(all(class(res$sim2) %in% c('list')))
40-
expect_true(all(names(res$sim2) %in% c('names', 'spec', 'class')))
41-
expect_length(res$sim2$names, 11)
42-
expect_length(res$sim2$class, 1)
43-
expect_length(res$sim3, 2)
44-
expect_true(all(class(res$sim3) %in% c('list')))
45-
expect_true(all(names(res$sim3) %in% c('names', 'spec', 'class')))
46-
expect_length(res$sim3$names, 11)
47-
expect_length(res$sim3$class, 1)
31+
if (ds.test_env$driver == "ArmadilloDriver") {
32+
expect_true(all(class(res) %in% c('list')))
33+
expect_length(res, 3)
34+
expect_length(res$sim1, 2)
35+
expect_true(all(class(res$sim1) %in% c('list')))
36+
expect_true(all(names(res$sim1) %in% c('names', 'spec', 'class')))
37+
expect_length(res$sim1$names, 11)
38+
expect_length(res$sim1$class, 3)
39+
expect_length(res$sim2, 2)
40+
expect_true(all(class(res$sim2) %in% c('list')))
41+
expect_true(all(names(res$sim2) %in% c('names', 'spec', 'class')))
42+
expect_length(res$sim2$names, 11)
43+
expect_length(res$sim2$class, 3)
44+
expect_length(res$sim3, 2)
45+
expect_true(all(class(res$sim3) %in% c('list')))
46+
expect_true(all(names(res$sim3) %in% c('names', 'spec', 'class')))
47+
expect_length(res$sim3$names, 11)
48+
expect_length(res$sim3$class, 3)
49+
} else if (ds.test_env$driver == "OpalDriver") {
50+
expect_true(all(class(res) %in% c('list')))
51+
expect_length(res, 3)
52+
expect_length(res$sim1, 2)
53+
expect_true(all(class(res$sim1) %in% c('list')))
54+
expect_true(all(names(res$sim1) %in% c('names', 'spec', 'class')))
55+
expect_length(res$sim1$names, 11)
56+
expect_length(res$sim1$class, 1)
57+
expect_length(res$sim2, 2)
58+
expect_true(all(class(res$sim2) %in% c('list')))
59+
expect_true(all(names(res$sim2) %in% c('names', 'spec', 'class')))
60+
expect_length(res$sim2$names, 11)
61+
expect_length(res$sim2$class, 1)
62+
expect_length(res$sim3, 2)
63+
expect_true(all(class(res$sim3) %in% c('list')))
64+
expect_true(all(names(res$sim3) %in% c('names', 'spec', 'class')))
65+
expect_length(res$sim3$names, 11)
66+
expect_length(res$sim3$class, 1)
67+
}
4868
})
4969

5070
test_that("column metadata", {
5171
res <- ds.metadata(x='D$LAB_TSC')
5272

73+
print(res)
74+
5375
if (ds.test_env$driver == "ArmadilloDriver") {
5476
expect_true(all(class(res) %in% c('list')))
5577
expect_length(res, 3)
56-
expect_length(res$sim1, 0)
57-
expect_length(res$sim2, 0)
58-
expect_length(res$sim3, 0)
78+
expect_length(res$sim1, 7)
79+
expect_length(res$sim2, 7)
80+
expect_length(res$sim3, 7)
5981
} else if (ds.test_env$driver == "OpalDriver") {
6082
expect_length(res$sim1, 6)
6183
expect_true(all(class(res$sim1) %in% c('list')))

tests/testthat/test-smk-ds.summary.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ test_that("summary_dataframe_variable", {
2828
res <- ds.summary(x='D')
2929

3030
expect_length(res, 3)
31-
expect_equal(res$sim1$class, "data.frame")
32-
expect_equal(res$sim2$class, "data.frame")
33-
expect_equal(res$sim3$class, "data.frame")
31+
expect_true(all(res$sim1$class %in% c("tbl_df", "tbl", "data.frame")))
32+
expect_true(all(res$sim2$class %in% c("tbl_df", "tbl", "data.frame")))
33+
expect_true(all(res$sim3$class %in% c("tbl_df", "tbl", "data.frame")))
3434
expect_equal(res$sim1$`number of rows`, 2163)
3535
expect_equal(res$sim2$`number of rows`, 3088)
3636
expect_equal(res$sim3$`number of rows`, 4128)

tests/testthat/test-smk-isDefined.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ test_that("default test, dataframe column E$A", {
5252
expect_length(class(err), 1)
5353
expect_true(all("list" %in% class(err)))
5454
expect_length(err, 3)
55-
expect_match(err$discordant1, "* Error : object 'E' not found")
56-
expect_match(err$discordant2, "* Error : object 'E' not found")
57-
expect_match(err$discordant3, "* Error : object 'E' not found")
55+
expect_match(err$discordant1, "* : object 'E' not found")
56+
expect_match(err$discordant2, "* : object 'E' not found")
57+
expect_match(err$discordant3, "* : object 'E' not found")
5858
})
5959

6060
test_that("default test, dataframe column D$A", {
@@ -123,9 +123,9 @@ test_that("error.message=FALSE test, dataframe column E$A", {
123123
expect_length(class(err), 1)
124124
expect_true(all("list" %in% class(err)))
125125
expect_length(err, 3)
126-
expect_match(err$discordant1, "* Error : object 'E' not found")
127-
expect_match(err$discordant2, "* Error : object 'E' not found")
128-
expect_match(err$discordant3, "* Error : object 'E' not found")
126+
expect_match(err$discordant1, "* : object 'E' not found")
127+
expect_match(err$discordant2, "* : object 'E' not found")
128+
expect_match(err$discordant3, "* : object 'E' not found")
129129
})
130130

131131
test_that("error.message=FALSE test, dataframe column D$A", {
@@ -222,9 +222,9 @@ test_that("error.message=TRUE test, dataframe column E$A", {
222222
expect_length(class(err), 1)
223223
expect_true(all("list" %in% class(err)))
224224
expect_length(err, 3)
225-
expect_match(err$discordant1, "* Error : object 'E' not found")
226-
expect_match(err$discordant2, "* Error : object 'E' not found")
227-
expect_match(err$discordant3, "* Error : object 'E' not found")
225+
expect_match(err$discordant1, "* : object 'E' not found")
226+
expect_match(err$discordant2, "* : object 'E' not found")
227+
expect_match(err$discordant3, "* : object 'E' not found")
228228
})
229229

230230
test_that("error.message=TRUE test, dataframe column D$A", {

0 commit comments

Comments
 (0)