/
test-smk-ds.list.R
83 lines (65 loc) · 2.22 KB
/
test-smk-ds.list.R
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
73
74
75
76
77
78
79
80
81
82
83
#-------------------------------------------------------------------------------
# Copyright (c) 2019-2022 University of Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
#
# Set up
#
context("ds.list::smk::setup")
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL"))
test_that("setup", {
ds_expect_variables(c("D"))
})
#
# Tests
#
context("ds.list::smk")
test_that("Is List", {
myobjects <- c('D$LAB_TSC', 'D$LAB_HDL')
res <- ds.list(x=myobjects, newobj='my_newobj')
expect_null(res)
res_ls <- ds.ls()
expect_length(res_ls, 3)
expect_length(res_ls$sim1, 2)
expect_length(res_ls$sim1$objects.found, 2)
expect_equal(res_ls$sim1$objects.found[1], 'D')
expect_equal(res_ls$sim1$objects.found[2], 'my_newobj')
expect_length(res_ls$sim3, 2)
expect_length(res_ls$sim2$objects.found, 2)
expect_equal(res_ls$sim2$objects.found[1], 'D')
expect_equal(res_ls$sim2$objects.found[2], 'my_newobj')
expect_length(res_ls$sim3, 2)
expect_length(res_ls$sim3$objects.found, 2)
expect_equal(res_ls$sim3$objects.found[1], 'D')
expect_equal(res_ls$sim3$objects.found[2], 'my_newobj')
res_class <- ds.class('my_newobj')
expect_length(res_class, 3)
expect_equal(res_class$sim1, 'list')
expect_equal(res_class$sim2, 'list')
expect_equal(res_class$sim3, 'list')
res_names <- ds.names('my_newobj')
expect_length(res_names, 3)
expect_length(res_names$sim1, 2)
expect_equal(res_names$sim1[1], 'LAB_TSC')
expect_equal(res_names$sim1[2], 'LAB_HDL')
expect_length(res_names$sim3, 2)
expect_equal(res_names$sim2[1], 'LAB_TSC')
expect_equal(res_names$sim2[2], 'LAB_HDL')
expect_length(res_names$sim3, 2)
expect_equal(res_names$sim3[1], 'LAB_TSC')
expect_equal(res_names$sim3[2], 'LAB_HDL')
})
#
# Tear down
#
context("ds.list::smk::shutdown")
test_that("shutdown", {
ds_expect_variables(c("D", "my_newobj"))
})
disconnect.studies.dataset.cnsim()
context("ds.list::smk::down")