|
| 1 | +#------------------------------------------------------------------------------- |
| 2 | +# |
| 3 | +# This program and the accompanying materials |
| 4 | +# are made available under the terms of the GNU Public License v3.0. |
| 5 | +# |
| 6 | +# You should have received a copy of the GNU General Public License |
| 7 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 8 | +#------------------------------------------------------------------------------- |
| 9 | + |
| 10 | +# |
| 11 | +# Set up |
| 12 | +# |
| 13 | + |
| 14 | +# context("ds.asDataMatrix::perf::setup") |
| 15 | +connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG")) |
| 16 | + |
| 17 | +# |
| 18 | +# Tests |
| 19 | +# |
| 20 | + |
| 21 | +# context("ds.asDataMatrix::perf:0") |
| 22 | +test_that("combine - performance", { |
| 23 | + .durationSec <- 30 # seconds |
| 24 | + .count <- 0 |
| 25 | + .start.time <- Sys.time() |
| 26 | + .current.time <- .start.time |
| 27 | + |
| 28 | + while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) { |
| 29 | + ds.asDataMatrix(x.name = "D", newobj = "perf.newobj") |
| 30 | + |
| 31 | + .count <- .count + 1 |
| 32 | + .current.time <- Sys.time() |
| 33 | + } |
| 34 | + |
| 35 | + .current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]]) |
| 36 | + .reference.rate <- perf.reference.rate("ds.asDataMatrix::perf::0") |
| 37 | + if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) { |
| 38 | + print(paste("ds.asDataMatrix::perf::0 ", .current.rate, 0.5, 2.0)) |
| 39 | + perf.reference.save("ds.asDataMatrix::perf::0", .current.rate, 0.5, 2.0) |
| 40 | + } else { |
| 41 | + print(paste("ds.asDataMatrix::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = '')) |
| 42 | + } |
| 43 | + |
| 44 | + .reference.rate <- perf.reference.rate("ds.asDataMatrix::perf::0") |
| 45 | + .reference.tolerance.lower <- perf.reference.tolerance.lower("ds.asDataMatrix::perf::0") |
| 46 | + .reference.tolerance.upper <- perf.reference.tolerance.upper("ds.asDataMatrix::perf::0") |
| 47 | + |
| 48 | + expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate") |
| 49 | + expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate") |
| 50 | +}) |
| 51 | + |
| 52 | +# |
| 53 | +# Done |
| 54 | +# |
| 55 | + |
| 56 | +# context("ds.asDataMatrix::perf::shutdown") |
| 57 | +disconnect.studies.dataset.cnsim() |
| 58 | +# context("ds.asDataMatrix::perf::done") |
0 commit comments