|
| 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.sqrt::smk::setup") |
| 16 | + |
| 17 | +connect.studies.dataset.cnsim(list("LAB_TSC")) |
| 18 | + |
| 19 | +test_that("setup", { |
| 20 | + ds_expect_variables(c("D")) |
| 21 | +}) |
| 22 | + |
| 23 | +# |
| 24 | +# Tests |
| 25 | +# |
| 26 | + |
| 27 | +context("ds.sqrt::smk") |
| 28 | +test_that("simple c", { |
| 29 | + res <- ds.sqrt("D$LAB_TSC", newobj = "sqrt.newobj") |
| 30 | + |
| 31 | + expect_true(is.null(res)) |
| 32 | + |
| 33 | + res.length <- ds.length("sqrt.newobj") |
| 34 | + |
| 35 | + expect_length(res.length, 4) |
| 36 | + expect_equal(res.length$`length of sqrt.newobj in sim1`, 2163) |
| 37 | + expect_equal(res.length$`length of sqrt.newobj in sim2`, 3088) |
| 38 | + expect_equal(res.length$`length of sqrt.newobj in sim3`, 4128) |
| 39 | + expect_equal(res.length$`total length of sqrt.newobj in all studies combined`, 9379) |
| 40 | + |
| 41 | + res.class <- ds.class("sqrt.newobj") |
| 42 | + |
| 43 | + expect_length(res.class, 3) |
| 44 | + expect_equal(res.class$sim1, "numeric") |
| 45 | + expect_equal(res.class$sim2, "numeric") |
| 46 | + expect_equal(res.class$sim3, "numeric") |
| 47 | +}) |
| 48 | + |
| 49 | +# |
| 50 | +# Done |
| 51 | +# |
| 52 | + |
| 53 | +context("ds.sqrt::smk::shutdown") |
| 54 | + |
| 55 | +test_that("setup", { |
| 56 | + ds_expect_variables(c("D", "sqrt.newobj")) |
| 57 | +}) |
| 58 | + |
| 59 | +disconnect.studies.dataset.cnsim() |
| 60 | + |
| 61 | +context("ds.sqrt::smk::done") |
0 commit comments