|
| 1 | +#------------------------------------------------------------------------------- |
| 2 | +# Copyright (c) 2018-2022 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.asDataFrame::smk::setup") |
| 16 | + |
| 17 | +connect.studies.dataset.cnsim(list("GENDER")) |
| 18 | + |
| 19 | +test_that("setup", { |
| 20 | + ds_expect_variables(c("D")) |
| 21 | +}) |
| 22 | + |
| 23 | +# |
| 24 | +# Tests |
| 25 | +# |
| 26 | + |
| 27 | +context("ds.asDataFrame::smk::simple test") |
| 28 | +test_that("simple test", { |
| 29 | + ds.asDataMatrix("D$GENDER") |
| 30 | + ds.asDataFrame(x.name="asdatamatrix.newobj") |
| 31 | + res.class <- ds.class("asdataframe.newobj") |
| 32 | + print(res.class) |
| 33 | + expect_length(res.class, 3) |
| 34 | + expect_length(res.class$sim1, 1) |
| 35 | + expect_true("data.frame" %in% res.class$sim1) |
| 36 | + expect_length(res.class$sim2, 1) |
| 37 | + expect_true("data.frame" %in% res.class$sim2) |
| 38 | + expect_length(res.class$sim3, 1) |
| 39 | + expect_true("data.frame" %in% res.class$sim3) |
| 40 | +}) |
| 41 | + |
| 42 | +# |
| 43 | +# Done |
| 44 | +# |
| 45 | + |
| 46 | +context("ds.asDataFrame::smk::shutdown") |
| 47 | + |
| 48 | +test_that("shutdown", { |
| 49 | + ds_expect_variables(c("D", "asdatamatrix.newobj", "asdataframe.newobj")) |
| 50 | +}) |
| 51 | + |
| 52 | +disconnect.studies.dataset.cnsim() |
| 53 | + |
| 54 | +context("ds.asDataFrame::smk::done") |
| 55 | + |
0 commit comments