-
Notifications
You must be signed in to change notification settings - Fork 23
/
test-arg-ds.tapply.assign.R
45 lines (34 loc) · 1.4 KB
/
test-arg-ds.tapply.assign.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
#-------------------------------------------------------------------------------
# Copyright (c) 2018-2020 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
#
connect.studies.dataset.cnsim(list("LAB_TSC", "GENDER"))
#
# Tests
#
context("ds.tapply.assign::arg::test errors")
test_that("tapply_erros", {
res1 <- ds.tapply.assign()
expect_length(res1, 1)
expect_equal(res1, "Error: Please provide the name of the variable to be summarized, as a character string")
res2 <- ds.tapply.assign('D$LAB_TSC')
expect_length(res2, 3)
expect_equal(res2$Error.message, "Error: Please provide the name of the single factor or")
expect_equal(res2$Err.cont2, "the list of factors to index the variable to be summarized.")
expect_equal(res2$Err.cont3, "In either case the argument must be specified in inverted commas")
res3 <- ds.tapply.assign('D$LAB_TSC', 'D$GENDER')
expect_length(res3, 1)
expect_equal(res3, "Error: Please provide a valid summarizing function, as a character string")
})
#
# Done
#
disconnect.studies.dataset.cnsim()