From b50a2777d2c0c449a90f5d009735174f95d081b3 Mon Sep 17 00:00:00 2001 From: nfrerebeau <33983845+nfrerebeau@users.noreply.github.com> Date: Sun, 3 Nov 2019 20:32:32 +0100 Subject: [PATCH] Add tests --- R/predicates.R | 2 -- tests/testthat/test-stratigraphy.R | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/R/predicates.R b/R/predicates.R index 5ec59c0..3606d10 100644 --- a/R/predicates.R +++ b/R/predicates.R @@ -289,8 +289,6 @@ is_dag <- function(x) { m <- m[!(m %in% G[, 2])] if (length(m) != 0) S <- append(S, m) - } else { - break() } k <- k + 1 } diff --git a/tests/testthat/test-stratigraphy.R b/tests/testthat/test-stratigraphy.R index f5c3403..a8f399a 100644 --- a/tests/testthat/test-stratigraphy.R +++ b/tests/testthat/test-stratigraphy.R @@ -23,6 +23,13 @@ test_that("Initialize a StratigraphicMatrix instance", { # Empty instence expect_s4_class(.StratigraphicMatrix(), "StratigraphicMatrix") }) +test_that("StratigraphicMatrix constructor", { + options("verbose" = TRUE) + cnd <- catch_conditions(StratigraphicMatrix()) + for (i in seq_len(2)) { + expect_s3_class(cnd[[i]], "message_class_initialize") + } +}) test_that("non DAG fails", { harris1 <- rbind(harris, c(1, 9)) cnd <- catch_conditions(as_stratigraphy(harris1))