From 4f8bea0f6d0f73826d078f62daac0576a11f5e85 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 1 Sep 2020 08:53:01 +0100 Subject: [PATCH 1/5] Fixed, context messages 'expt' -> 'expt_dgr' --- .../testthat/test-expt_dgr-ds.dataFrameSort.R | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/testthat/test-expt_dgr-ds.dataFrameSort.R b/tests/testthat/test-expt_dgr-ds.dataFrameSort.R index 35956c5b..cb873f6b 100644 --- a/tests/testthat/test-expt_dgr-ds.dataFrameSort.R +++ b/tests/testthat/test-expt_dgr-ds.dataFrameSort.R @@ -8,12 +8,12 @@ # along with this program. If not, see . #------------------------------------------------------------------------------- -context('ds.dataFrameSort::expt::setup') +context('ds.dataFrameSort::expt_dgr::setup') source('connection_to_datasets/init_testing_datasets.R') source('definition_tests/def-ds.dataFrameSort.R') -context("ds.dataFrameSort::expt::multiple::correct_parameter_class") +context("ds.dataFrameSort::expt_dgr::multiple::correct_parameter_class") test_that('all datasets', { connect.all.datasets() @@ -31,7 +31,7 @@ test_that('all datasets', .test.function.parameters("D","D$NUMERIC_ONE_CHANGE",TRUE,"alphabetic","server.data") .test.function.parameters("D","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) -context("ds.dataFrameSort::expt::single::correct_parameter_class") +context("ds.dataFrameSort::expt_dgr::single::correct_parameter_class") test_that('dataset 2', { connect.dataset.2() @@ -49,7 +49,7 @@ test_that('dataset 2', .test.function.parameters("D","D$NUMERIC_ONE_CHANGE",TRUE,"alphabetic","server.data") .test.function.parameters("D","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) -context("ds.dataFrameSort::expt::multiple::incorrect_parameter_class") +context("ds.dataFrameSort::expt_dgr::multiple::incorrect_parameter_class") test_that('all datasets', { connect.all.datasets() @@ -65,7 +65,7 @@ test_that('all datasets', .test.function.parameters("D","D$NUMERIC_ONE_CHANGE",TRUE,"alphabetic",23) .test.function.parameters("dataframe","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) -context("ds.dataFrameSort::expt::single::incorrect_parameter_class") +context("ds.dataFrameSort::expt_dgr::single::incorrect_parameter_class") test_that('dataset 2', { connect.dataset.2() @@ -82,7 +82,7 @@ test_that('dataset 2', .test.function.parameters("dataframe","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) -context("ds.dataFrameSort::expt::multiple::df::creation") +context("ds.dataFrameSort::expt_dgr::multiple::df::creation") test_that('all datasets', { connect.all.datasets() @@ -98,7 +98,7 @@ test_that('all datasets', .test.data.frame.creation("D","NUMERIC_ONE_CHANGE",TRUE,"numeric","server.data") .test.data.frame.creation("D","INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) -context("ds.dataFrameSort::expt::single::df::creation") +context("ds.dataFrameSort::expt_dgr::single::df::creation") test_that('dataset 3', { connect.dataset.3() @@ -114,7 +114,7 @@ test_that('dataset 3', .test.data.frame.creation("D","NUMERIC_ONE_CHANGE",TRUE,"numeric","server.data") .test.data.frame.creation("D","INTEGER_ONE_CHANGE",FALSE,"alphabetic","server.data") }) -context("ds.dataFrameSort::expt::multiple::numeric::ascending") +context("ds.dataFrameSort::expt_dgr::multiple::numeric::ascending") test_that('all datasets', { connect.all.datasets() @@ -124,7 +124,7 @@ test_that('all datasets', local.df.list[[i]][,"FACTOR_INTEGER"]<-as.factor(local.df.list[[i]][,"FACTOR_INTEGER"]) colnames(local.df.list[[i]])<-ds.colnames("D",datasources = ds.test_env$connections[i][[1]]) } - + print('------') .test.data.frame.sorting("D","LOGICAL",FALSE,"numeric","server.data",local.df.list) #.test.data.frame.sorting("D","INTEGER",FALSE,"numeric","server.data",local.df.list) .test.data.frame.sorting("D","POSITIVE_INTEGER",FALSE,"numeric","server.data",local.df.list) @@ -142,7 +142,7 @@ test_that('all datasets', }) -context("ds.dataFrameSort::expt::single::numeric::ascending") +context("ds.dataFrameSort::expt_dgr::single::numeric::ascending") test_that('dataset 1', { connect.dataset.1() @@ -172,7 +172,7 @@ test_that('dataset 1', }) -context("ds.dataFrameSort::expt::multiple::numeric::descending") +context("ds.dataFrameSort::expt_dgr::multiple::numeric::descending") test_that('all datasets', { connect.all.datasets() @@ -199,7 +199,7 @@ test_that('all datasets', }) -context("ds.dataFrameSort::expt::single::numeric::descending") +context("ds.dataFrameSort::expt_dgr::single::numeric::descending") test_that('dataset 1', { connect.dataset.1() @@ -228,7 +228,7 @@ test_that('dataset 1', }) -context("ds.dataFrameSort::expt::multiple::alphabetic::ascending") +context("ds.dataFrameSort::expt_dgr::multiple::alphabetic::ascending") test_that('all datasets', { connect.all.datasets() @@ -255,7 +255,7 @@ test_that('all datasets', #.test.data.frame.sorting("D","FACTOR_CHARACTER",FALSE,"alphabetic","server.data",local.df.list) .test.data.frame.sorting("D","CHARACTER",FALSE,"alphabetic","server.data",local.df.list) }) -context("ds.dataFrameSort::expt::single::alphabetic::ascending") +context("ds.dataFrameSort::expt_dgr::single::alphabetic::ascending") test_that('dataset 2', { connect.dataset.2() @@ -282,7 +282,7 @@ test_that('dataset 2', #.test.data.frame.sorting("D","FACTOR_CHARACTER",FALSE,"alphabetic","server.data",local.df.list) .test.data.frame.sorting("D","CHARACTER",FALSE,"alphabetic","server.data",local.df.list) }) -context("ds.dataFrameSort::expt::multiple::alphabetic::descending") +context("ds.dataFrameSort::expt_dgr::multiple::alphabetic::descending") test_that('all datasets', { connect.all.datasets() @@ -307,7 +307,7 @@ test_that('all datasets', #.test.data.frame.sorting("D","FACTOR_CHARACTER",TRUE,"alphabetic","server.data",local.df.list) .test.data.frame.sorting("D","CHARACTER",TRUE,"alphabetic","server.data",local.df.list) }) -context("ds.dataFrameSort::expt::single::alphabetic::descending") +context("ds.dataFrameSort::expt_dgr::single::alphabetic::descending") test_that('dataset 3', { connect.dataset.3() @@ -334,7 +334,7 @@ test_that('dataset 3', }) -context('ds.dataFrameSort::expt::shutdown') +context('ds.dataFrameSort::expt_dgr::shutdown') -context('ds.dataFrameSort::expt::done') +context('ds.dataFrameSort::expt_dgr::done') From 56e07348c6c4a3b2e3e43872cb0a9de0f0c37e3a Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 1 Sep 2020 13:06:30 +0100 Subject: [PATCH 2/5] Fixed context messages, 'expt' -> 'expt_dgr' --- .../test-expt_dgr-ds.dataFrameSubset.R | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/tests/testthat/test-expt_dgr-ds.dataFrameSubset.R b/tests/testthat/test-expt_dgr-ds.dataFrameSubset.R index aa6b9b28..191b0ee5 100644 --- a/tests/testthat/test-expt_dgr-ds.dataFrameSubset.R +++ b/tests/testthat/test-expt_dgr-ds.dataFrameSubset.R @@ -8,11 +8,20 @@ # along with this program. If not, see . #------------------------------------------------------------------------------- +# +# Set up +# + +context("ds.dataFrameSubset()::expt_dgr::setup") + source("connection_to_datasets/init_testing_datasets.R") source("definition_tests/def-ds.dataFrameSubset.R") +# +# Tests +# -context("ds.dataFrameSubset()::expt::multiple::parameter_class") +context("ds.dataFrameSubset()::expt_dgr::multiple::parameter_class") test_that('all datasets', { connect.all.datasets() @@ -32,7 +41,7 @@ test_that('all datasets', }) -context("ds.dataFrameSubset()::expt::single::parameter_class") +context("ds.dataFrameSubset()::expt_dgr::single::parameter_class") test_that('dataset 1', { connect.dataset.1() @@ -52,7 +61,7 @@ test_that('dataset 1', }) -context("ds.dataFrameSubset()::expt::multiple::all_columns") +context("ds.dataFrameSubset()::expt_dgr::multiple::all_columns") test_that('all datasets', { connect.all.datasets() @@ -64,7 +73,7 @@ test_that('all datasets', .test.data.frame.creation("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC","<=","subset.server") }) -context("ds.dataFrameSubset()::expt::single::all_columns") +context("ds.dataFrameSubset()::expt_dgr::single::all_columns") test_that('dataset 2', { connect.dataset.2() @@ -76,7 +85,7 @@ test_that('dataset 2', .test.data.frame.creation("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC","<=","subset.server") }) -context("ds.dataFrameSubset()::expt::multiple::all_columns::subset_by_rows") +context("ds.dataFrameSubset()::expt_dgr::multiple::all_columns::subset_by_rows") test_that("all datasets", { connect.all.datasets() @@ -95,7 +104,7 @@ test_that("all datasets", subset.by.rows("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC","<=",FALSE,"subset.server",local.df.list) }) -context("ds.dataFrameSubset()::expt::single::all_columns::subset_by_rows") +context("ds.dataFrameSubset()::expt_dgr::single::all_columns::subset_by_rows") test_that("dataset 3", { connect.dataset.3() @@ -114,7 +123,7 @@ test_that("dataset 3", subset.by.rows("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC","<=",FALSE,"subset.server",local.df.list) }) -context("ds.dataFrameSubset()::expt::multiple::subset_by_rows_columns") +context("ds.dataFrameSubset()::expt_dgr::multiple::subset_by_rows_columns") test_that("all datasets", { connect.all.datasets() @@ -132,7 +141,8 @@ test_that("all datasets", subset.by.rows.cols("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC",1:15,"<=",TRUE,"subset.server",local.df.list) subset.by.rows.cols("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC",1:15,"<=",FALSE,"subset.server",local.df.list) }) -context("ds.dataFrameSubset()::expt::single::subset_by_rows_columns") + +context("ds.dataFrameSubset()::expt_dgr::single::subset_by_rows_columns") test_that("dataset 1", { connect.dataset.1() @@ -152,8 +162,7 @@ test_that("dataset 1", }) - -context("ds.dataFrameSubset()::expt::multiple::subset_by_rows_columns") +context("ds.dataFrameSubset()::expt_dgr::multiple::subset_by_rows_columns") test_that("all datasets", { connect.all.datasets() @@ -171,7 +180,7 @@ test_that("all datasets", subset.by.rows.cols("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC",1:15,"<=",TRUE,"subset.server",local.df.list) subset.by.rows.cols("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC",1:15,"<=",FALSE,"subset.server",local.df.list) }) -context("ds.dataFrameSubset()::expt::single::subset_by_rows_columns") +context("ds.dataFrameSubset()::expt_dgr::single::subset_by_rows_columns") test_that("dataset 2", { connect.dataset.2() @@ -189,7 +198,8 @@ test_that("dataset 2", subset.by.rows.cols("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC",1:15,"<=",TRUE,"subset.server",local.df.list) subset.by.rows.cols("D","POSITIVE_NUMERIC","NON_NEGATIVE_NUMERIC",1:15,"<=",FALSE,"subset.server",local.df.list) }) -context("ds.dataFrameSubset()::expt::multiple::all_rows_subset_by_columns") + +context("ds.dataFrameSubset()::expt_dgr::multiple::all_rows_subset_by_columns") test_that("all datasets", { connect.all.datasets() local.df.list<-list(ds.test_env$local.values.1[,-1],ds.test_env$local.values.2[,-1],ds.test_env$local.values.3[,-1]) @@ -200,7 +210,8 @@ test_that("all datasets", subset.by.cols("D","POSITIVE_NUMERIC",c(2:5,12:14),TRUE,"subset.server",local.df.list) subset.by.cols("D","NON_NEGATIVE_NUMERIC",c(1:7,13:16),FALSE,"subset.server",local.df.list) }) -context("ds.dataFrameSubset()::expt::multiple::all_rows_subset_by_columns") + +context("ds.dataFrameSubset()::expt_dgr::multiple::all_rows_subset_by_columns") test_that("dataset 3", { connect.dataset.3() local.df.list<-list(ds.test_env$local.values.3[,-1]) @@ -210,4 +221,12 @@ test_that("dataset 3", subset.by.cols("D","NUMERIC",c(3:7,10,15),FALSE,"subset.server",local.df.list) subset.by.cols("D","POSITIVE_NUMERIC",c(2:5,12:14),TRUE,"subset.server",local.df.list) subset.by.cols("D","NON_NEGATIVE_NUMERIC",c(1:7,13:16),FALSE,"subset.server",local.df.list) - }) \ No newline at end of file + }) + +# +# Shutdown +# + +# +# Done +# From 6146a0dcff936de5627bd963fbb6d0dd9af75253 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 1 Sep 2020 14:13:58 +0100 Subject: [PATCH 3/5] Tidy-up, plus remove debug output --- .../testthat/test-expt_dgr-ds.dataFrameSort.R | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-expt_dgr-ds.dataFrameSort.R b/tests/testthat/test-expt_dgr-ds.dataFrameSort.R index cb873f6b..a3d6082f 100644 --- a/tests/testthat/test-expt_dgr-ds.dataFrameSort.R +++ b/tests/testthat/test-expt_dgr-ds.dataFrameSort.R @@ -8,11 +8,19 @@ # along with this program. If not, see . #------------------------------------------------------------------------------- +# +# Set up +# + context('ds.dataFrameSort::expt_dgr::setup') source('connection_to_datasets/init_testing_datasets.R') source('definition_tests/def-ds.dataFrameSort.R') +# +# Tests +# + context("ds.dataFrameSort::expt_dgr::multiple::correct_parameter_class") test_that('all datasets', { @@ -31,6 +39,7 @@ test_that('all datasets', .test.function.parameters("D","D$NUMERIC_ONE_CHANGE",TRUE,"alphabetic","server.data") .test.function.parameters("D","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) + context("ds.dataFrameSort::expt_dgr::single::correct_parameter_class") test_that('dataset 2', { @@ -49,6 +58,7 @@ test_that('dataset 2', .test.function.parameters("D","D$NUMERIC_ONE_CHANGE",TRUE,"alphabetic","server.data") .test.function.parameters("D","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) + context("ds.dataFrameSort::expt_dgr::multiple::incorrect_parameter_class") test_that('all datasets', { @@ -65,6 +75,7 @@ test_that('all datasets', .test.function.parameters("D","D$NUMERIC_ONE_CHANGE",TRUE,"alphabetic",23) .test.function.parameters("dataframe","D$INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) + context("ds.dataFrameSort::expt_dgr::single::incorrect_parameter_class") test_that('dataset 2', { @@ -98,6 +109,7 @@ test_that('all datasets', .test.data.frame.creation("D","NUMERIC_ONE_CHANGE",TRUE,"numeric","server.data") .test.data.frame.creation("D","INTEGER_ONE_CHANGE",TRUE,"numeric","server.data") }) + context("ds.dataFrameSort::expt_dgr::single::df::creation") test_that('dataset 3', { @@ -114,6 +126,7 @@ test_that('dataset 3', .test.data.frame.creation("D","NUMERIC_ONE_CHANGE",TRUE,"numeric","server.data") .test.data.frame.creation("D","INTEGER_ONE_CHANGE",FALSE,"alphabetic","server.data") }) + context("ds.dataFrameSort::expt_dgr::multiple::numeric::ascending") test_that('all datasets', { @@ -124,7 +137,6 @@ test_that('all datasets', local.df.list[[i]][,"FACTOR_INTEGER"]<-as.factor(local.df.list[[i]][,"FACTOR_INTEGER"]) colnames(local.df.list[[i]])<-ds.colnames("D",datasources = ds.test_env$connections[i][[1]]) } - print('------') .test.data.frame.sorting("D","LOGICAL",FALSE,"numeric","server.data",local.df.list) #.test.data.frame.sorting("D","INTEGER",FALSE,"numeric","server.data",local.df.list) .test.data.frame.sorting("D","POSITIVE_INTEGER",FALSE,"numeric","server.data",local.df.list) @@ -139,9 +151,8 @@ test_that('all datasets', .test.data.frame.sorting("D","FACTOR_INTEGER",FALSE,"numeric","server.data",local.df.list) #.test.data.frame.sorting("D","FACTOR_CHARACTER",FALSE,"numeric","server.data",local.df.list) #.test.data.frame.sorting("D","CHARACTER",FALSE,"numeric","server.data",local.df.list) - - }) + context("ds.dataFrameSort::expt_dgr::single::numeric::ascending") test_that('dataset 1', { @@ -172,6 +183,7 @@ test_that('dataset 1', }) + context("ds.dataFrameSort::expt_dgr::multiple::numeric::descending") test_that('all datasets', { @@ -199,6 +211,7 @@ test_that('all datasets', }) + context("ds.dataFrameSort::expt_dgr::single::numeric::descending") test_that('dataset 1', { @@ -255,6 +268,7 @@ test_that('all datasets', #.test.data.frame.sorting("D","FACTOR_CHARACTER",FALSE,"alphabetic","server.data",local.df.list) .test.data.frame.sorting("D","CHARACTER",FALSE,"alphabetic","server.data",local.df.list) }) + context("ds.dataFrameSort::expt_dgr::single::alphabetic::ascending") test_that('dataset 2', { @@ -282,6 +296,7 @@ test_that('dataset 2', #.test.data.frame.sorting("D","FACTOR_CHARACTER",FALSE,"alphabetic","server.data",local.df.list) .test.data.frame.sorting("D","CHARACTER",FALSE,"alphabetic","server.data",local.df.list) }) + context("ds.dataFrameSort::expt_dgr::multiple::alphabetic::descending") test_that('all datasets', { @@ -307,6 +322,7 @@ test_that('all datasets', #.test.data.frame.sorting("D","FACTOR_CHARACTER",TRUE,"alphabetic","server.data",local.df.list) .test.data.frame.sorting("D","CHARACTER",TRUE,"alphabetic","server.data",local.df.list) }) + context("ds.dataFrameSort::expt_dgr::single::alphabetic::descending") test_that('dataset 3', { @@ -333,8 +349,14 @@ test_that('dataset 3', .test.data.frame.sorting("D","CHARACTER",TRUE,"alphabetic","server.data",local.df.list) }) +# +# Shutdown +# context('ds.dataFrameSort::expt_dgr::shutdown') +# +# Done +# context('ds.dataFrameSort::expt_dgr::done') From 78c5d8fd46c6c0d9a9f25a701cbf3f303d85d060 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 1 Sep 2020 17:27:29 +0100 Subject: [PATCH 4/5] Minor tidyup --- tests/testthat/test-smk_dgr-ds.asCharacter.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-smk_dgr-ds.asCharacter.R b/tests/testthat/test-smk_dgr-ds.asCharacter.R index d89012a8..bfd3e755 100644 --- a/tests/testthat/test-smk_dgr-ds.asCharacter.R +++ b/tests/testthat/test-smk_dgr-ds.asCharacter.R @@ -36,7 +36,7 @@ test_that("simple test", { }) # -# Done +# Shutdown # context("ds.asCharacter::smk_dgr::stutdown") @@ -47,4 +47,8 @@ test_that("setup", { disconnect.studies.dataset.cnsim() +# +# Done +# + context("ds.asCharacter::smk_dgr::done") From 7124b26c0b61372f4e8ecce6f99204aeadd151c4 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 1 Sep 2020 17:28:17 +0100 Subject: [PATCH 5/5] Added tests of present of 'Danger' functions --- .../test-smk_dgr-ds.listClientsideFunctions.R | 67 ++++++++++++++ .../test-smk_dgr-ds.listServersideFunctions.R | 88 +++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 tests/testthat/test-smk_dgr-ds.listClientsideFunctions.R create mode 100644 tests/testthat/test-smk_dgr-ds.listServersideFunctions.R diff --git a/tests/testthat/test-smk_dgr-ds.listClientsideFunctions.R b/tests/testthat/test-smk_dgr-ds.listClientsideFunctions.R new file mode 100644 index 00000000..911dd3f6 --- /dev/null +++ b/tests/testthat/test-smk_dgr-ds.listClientsideFunctions.R @@ -0,0 +1,67 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2019-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 . +#------------------------------------------------------------------------------- + +# +# Set up +# + +context("ds.listClientsideFunctions:smk_dgr::setup") + +require(dsDangerClient) + +connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL")) + +test_that("setup", { + ds_expect_variables(c("D")) +}) + +# +# Tests +# + +context("ds.listClientsideFunctions:smk_dgr::check results") +test_that("check results", { + output <- list( + "ds.DANGERc2sMATDF", + "ds.DANGERdfEXTRACT", + "ds.DANGERlistcode", + "ds.DANGERpassPARSER", + "ds.DANGERplot", + "ds.DANGERprint", + "ds.danger", + "ds.DANGERsearch", + "ds.DANGERseedEXTRACT", + "ds.DANGERvarsEXTRACT" + ) + + res <- ls(pos="package:dsDangerClient") + + for (func.name in output) { + expect_true(func.name %in% res, info = func.name) + } +}) + +# +# Shutdown +# + +context("ds.listClientsideFunctions:smk_dgr::shutdown") + +test_that("shutdown", { + ds_expect_variables(c("D")) +}) + +disconnect.studies.dataset.cnsim() + +# +# Done +# + +context("ds.listClientsideFunctions:smk_dgr::done") diff --git a/tests/testthat/test-smk_dgr-ds.listServersideFunctions.R b/tests/testthat/test-smk_dgr-ds.listServersideFunctions.R new file mode 100644 index 00000000..a466c357 --- /dev/null +++ b/tests/testthat/test-smk_dgr-ds.listServersideFunctions.R @@ -0,0 +1,88 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2019-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 . +#------------------------------------------------------------------------------- + +# +# Set up +# + +context("ds.listServersideFunctions::smk_dgr::setup") + +require(dsDangerClient) + +connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL")) + +test_that("setup", { + ds_expect_variables(c("D")) +}) + +# +# Tests +# + +context("ds.listServersideFunctions::smk_dgr::check results") +test_that("check results", { + assign.functions <- factor(c( + )) + aggregate.functions <- factor(c( + "DANGERc2sMATDFDS", + "DANGERlistcodeDS", + "DANGERdfEXTRACTDS", + "DANGERpassPARSERDS", + "DANGERprintDS", + "DANGERplotDS", + "DANGERsearchDS", + "DANGERseedEXTRACTDS", + "DANGERvarsEXTRACTDS" + )) + + expect_warning(res <- ds.listServersideFunctions(), "'ds.listServersideFunctions' is deprecated.", fixed=TRUE) + + expect_length(res, 2) + expect_length(res$serverside.assign.functions, 7) + expect_length(res$serverside.aggregate.functions, 7) + + sim1.assign.res <- subset(res$serverside.assign.functions, server == 'sim1', c('name')) + sim1.aggregate.res <- subset(res$serverside.aggregate.functions, server == 'sim1', c('name')) + sim2.assign.res <- subset(res$serverside.assign.functions, server == 'sim2', c('name')) + sim2.aggregate.res <- subset(res$serverside.aggregate.functions, server == 'sim2', c('name')) + sim3.assign.res <- subset(res$serverside.assign.functions, server == 'sim3', c('name')) + sim3.aggregate.res <- subset(res$serverside.aggregate.functions, server == 'sim3', c('name')) + + for (func.name in assign.functions) + expect_true(func.name %in% sim1.assign.res$name, info = func.name) + for (func.name in aggregate.functions) + expect_true(func.name %in% sim1.aggregate.res$name, info = func.name) + for (func.name in assign.functions) + expect_true(func.name %in% sim2.assign.res$name, info = func.name) + for (func.name in aggregate.functions) + expect_true(func.name %in% sim2.aggregate.res$name, info = func.name) + for (func.name in assign.functions) + expect_true(func.name %in% sim3.assign.res$name, info = func.name) + for (func.name in aggregate.functions) + expect_true(func.name %in% sim3.aggregate.res$name, info = func.name) +}) + +# +# Done +# + +context("ds.listServersideFunctions::smk_dgr::shtudown") + +test_that("shutdown", { + ds_expect_variables(c("D")) +}) + +disconnect.studies.dataset.cnsim() + +# +# Done +# + +context("ds.listServersideFunctions::smk_dgr::done")