Skip to content

Commit 7124b26

Browse files
committed
Added tests of present of 'Danger' functions
1 parent 78c5d8f commit 7124b26

2 files changed

Lines changed: 155 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2019-2020 University of Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
context("ds.listClientsideFunctions:smk_dgr::setup")
16+
17+
require(dsDangerClient)
18+
19+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL"))
20+
21+
test_that("setup", {
22+
ds_expect_variables(c("D"))
23+
})
24+
25+
#
26+
# Tests
27+
#
28+
29+
context("ds.listClientsideFunctions:smk_dgr::check results")
30+
test_that("check results", {
31+
output <- list(
32+
"ds.DANGERc2sMATDF",
33+
"ds.DANGERdfEXTRACT",
34+
"ds.DANGERlistcode",
35+
"ds.DANGERpassPARSER",
36+
"ds.DANGERplot",
37+
"ds.DANGERprint",
38+
"ds.danger",
39+
"ds.DANGERsearch",
40+
"ds.DANGERseedEXTRACT",
41+
"ds.DANGERvarsEXTRACT"
42+
)
43+
44+
res <- ls(pos="package:dsDangerClient")
45+
46+
for (func.name in output) {
47+
expect_true(func.name %in% res, info = func.name)
48+
}
49+
})
50+
51+
#
52+
# Shutdown
53+
#
54+
55+
context("ds.listClientsideFunctions:smk_dgr::shutdown")
56+
57+
test_that("shutdown", {
58+
ds_expect_variables(c("D"))
59+
})
60+
61+
disconnect.studies.dataset.cnsim()
62+
63+
#
64+
# Done
65+
#
66+
67+
context("ds.listClientsideFunctions:smk_dgr::done")
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2019-2020 University of Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
context("ds.listServersideFunctions::smk_dgr::setup")
16+
17+
require(dsDangerClient)
18+
19+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL"))
20+
21+
test_that("setup", {
22+
ds_expect_variables(c("D"))
23+
})
24+
25+
#
26+
# Tests
27+
#
28+
29+
context("ds.listServersideFunctions::smk_dgr::check results")
30+
test_that("check results", {
31+
assign.functions <- factor(c(
32+
))
33+
aggregate.functions <- factor(c(
34+
"DANGERc2sMATDFDS",
35+
"DANGERlistcodeDS",
36+
"DANGERdfEXTRACTDS",
37+
"DANGERpassPARSERDS",
38+
"DANGERprintDS",
39+
"DANGERplotDS",
40+
"DANGERsearchDS",
41+
"DANGERseedEXTRACTDS",
42+
"DANGERvarsEXTRACTDS"
43+
))
44+
45+
expect_warning(res <- ds.listServersideFunctions(), "'ds.listServersideFunctions' is deprecated.", fixed=TRUE)
46+
47+
expect_length(res, 2)
48+
expect_length(res$serverside.assign.functions, 7)
49+
expect_length(res$serverside.aggregate.functions, 7)
50+
51+
sim1.assign.res <- subset(res$serverside.assign.functions, server == 'sim1', c('name'))
52+
sim1.aggregate.res <- subset(res$serverside.aggregate.functions, server == 'sim1', c('name'))
53+
sim2.assign.res <- subset(res$serverside.assign.functions, server == 'sim2', c('name'))
54+
sim2.aggregate.res <- subset(res$serverside.aggregate.functions, server == 'sim2', c('name'))
55+
sim3.assign.res <- subset(res$serverside.assign.functions, server == 'sim3', c('name'))
56+
sim3.aggregate.res <- subset(res$serverside.aggregate.functions, server == 'sim3', c('name'))
57+
58+
for (func.name in assign.functions)
59+
expect_true(func.name %in% sim1.assign.res$name, info = func.name)
60+
for (func.name in aggregate.functions)
61+
expect_true(func.name %in% sim1.aggregate.res$name, info = func.name)
62+
for (func.name in assign.functions)
63+
expect_true(func.name %in% sim2.assign.res$name, info = func.name)
64+
for (func.name in aggregate.functions)
65+
expect_true(func.name %in% sim2.aggregate.res$name, info = func.name)
66+
for (func.name in assign.functions)
67+
expect_true(func.name %in% sim3.assign.res$name, info = func.name)
68+
for (func.name in aggregate.functions)
69+
expect_true(func.name %in% sim3.aggregate.res$name, info = func.name)
70+
})
71+
72+
#
73+
# Done
74+
#
75+
76+
context("ds.listServersideFunctions::smk_dgr::shtudown")
77+
78+
test_that("shutdown", {
79+
ds_expect_variables(c("D"))
80+
})
81+
82+
disconnect.studies.dataset.cnsim()
83+
84+
#
85+
# Done
86+
#
87+
88+
context("ds.listServersideFunctions::smk_dgr::done")

0 commit comments

Comments
 (0)