Running 'testthat.R' [37s/41s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(dirichletprocess)
  > 
  > test_check("dirichletprocess")
  Accept Ratio:  0.026 
  Accept Ratio:  0.025 
  Accept Ratio:  0.01 
  Accept Ratio:  0.021 
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dirichletprocess
   --- call from context --- 
  Mvnormal2Create(pp)
   --- call from argument --- 
  if (class(priorParameters$mu0) != "matrix") {
      priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
  }
   --- R stacktrace ---
  where 1 at testthat/test_mvnormal_semi_conjugate.R#10: Mvnormal2Create(pp)
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test_mvnormal_semi_conjugate.R#8: test_that("Mixture Object Create", {
      mdobj <- Mvnormal2Create(pp)
      expect_s3_class(mdobj, c("list", "MixingDistribution", "mvnormal", 
          "nonconjugate"))
  })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 40: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_check("dirichletprocess")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (priorParameters) 
  {
      if (class(priorParameters$mu0) != "matrix") {
          priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
      }
      mdObj <- MixingDistribution("mvnormal2", priorParameters, 
          "nonconjugate")
      return(mdObj)
  }
  <bytecode: 0x4b7f398>
  <environment: namespace:dirichletprocess>
   --- function search by body ---
  Function Mvnormal2Create in namespace dirichletprocess has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 1. Error: Mixture Object Create (@test_mvnormal_semi_conjugate.R#10)  -------
  the condition has length > 1
  Backtrace:
   1. dirichletprocess::Mvnormal2Create(pp)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dirichletprocess
   --- call from context --- 
  Mvnormal2Create(pp)
   --- call from argument --- 
  if (class(priorParameters$mu0) != "matrix") {
      priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
  }
   --- R stacktrace ---
  where 1 at testthat/test_mvnormal_semi_conjugate.R#17: Mvnormal2Create(pp)
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test_mvnormal_semi_conjugate.R#15: test_that("Multivariate Normal Likelihood", {
      mdobj <- Mvnormal2Create(pp)
      test_theta <- list(mu = array(c(0, 0), c(1, 2, 1)), sig = array(diag(2), 
          c(2, 2, 1)))
      lik_test <- Likelihood(mdobj, c(0, 0), test_theta)
      expect_equal(lik_test, 1/sqrt(4 * pi^2))
      test_theta_multi <- list(mu = array(c(0, 0), c(1, 2, 2)), 
          sig = array(diag(2), c(2, 2, 2)))
      lik_test_multi <- Likelihood(mdobj, c(0, 0), test_theta_multi)
      expect_equal(lik_test_multi, rep.int(1/sqrt(4 * pi^2), 2))
  })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 40: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_check("dirichletprocess")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (priorParameters) 
  {
      if (class(priorParameters$mu0) != "matrix") {
          priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
      }
      mdObj <- MixingDistribution("mvnormal2", priorParameters, 
          "nonconjugate")
      return(mdObj)
  }
  <bytecode: 0x4b7f398>
  <environment: namespace:dirichletprocess>
   --- function search by body ---
  Function Mvnormal2Create in namespace dirichletprocess has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 2. Error: Multivariate Normal Likelihood (@test_mvnormal_semi_conjugate.R#17)
  the condition has length > 1
  Backtrace:
   1. dirichletprocess::Mvnormal2Create(pp)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dirichletprocess
   --- call from context --- 
  Mvnormal2Create(pp)
   --- call from argument --- 
  if (class(priorParameters$mu0) != "matrix") {
      priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
  }
   --- R stacktrace ---
  where 1 at testthat/test_mvnormal_semi_conjugate.R#32: Mvnormal2Create(pp)
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test_mvnormal_semi_conjugate.R#30: test_that("Multivariate Normal Prior Draw", {
      mdobj <- Mvnormal2Create(pp)
      PriorDraw_test_single <- PriorDraw(mdobj, 1)
      expect_is(PriorDraw_test_single, "list")
      PriorDraw_test_multiple <- PriorDraw(mdobj, 10)
      expect_is(PriorDraw_test_multiple, "list")
      expect_equal(dim(PriorDraw_test_multiple$mu), c(1, 2, 10))
      expect_equal(dim(PriorDraw_test_multiple$sig), c(2, 2, 10))
  })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 40: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_check("dirichletprocess")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (priorParameters) 
  {
      if (class(priorParameters$mu0) != "matrix") {
          priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
      }
      mdObj <- MixingDistribution("mvnormal2", priorParameters, 
          "nonconjugate")
      return(mdObj)
  }
  <bytecode: 0x4b7f398>
  <environment: namespace:dirichletprocess>
   --- function search by body ---
  Function Mvnormal2Create in namespace dirichletprocess has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 3. Error: Multivariate Normal Prior Draw (@test_mvnormal_semi_conjugate.R#32)
  the condition has length > 1
  Backtrace:
   1. dirichletprocess::Mvnormal2Create(pp)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dirichletprocess
   --- call from context --- 
  Mvnormal2Create(pp)
   --- call from argument --- 
  if (class(priorParameters$mu0) != "matrix") {
      priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
  }
   --- R stacktrace ---
  where 1 at testthat/test_mvnormal_semi_conjugate.R#49: Mvnormal2Create(pp)
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test_mvnormal_semi_conjugate.R#46: test_that("Multivariate Normal Posterior Draw", {
      test_data <- mvtnorm::rmvnorm(10, c(0, 0), diag(2))
      mdobj <- Mvnormal2Create(pp)
      post_draws_single <- PosteriorDraw(mdobj, test_data, 1)
      expect_is(post_draws_single, "list")
      expect_equal(length(post_draws_single), 2)
      expect_equal(dim(post_draws_single$mu), c(1, 2, 1))
      expect_equal(dim(post_draws_single$sig), c(2, 2, 1))
      post_draws_multi <- PosteriorDraw(mdobj, test_data[1, ], 
          10)
      expect_equal(length(post_draws_multi), 2)
      expect_equal(dim(post_draws_multi$mu), c(1, 2, 10))
      expect_equal(dim(post_draws_multi$sig), c(2, 2, 10))
      expect_is(post_draws_multi, "list")
  })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 40: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_check("dirichletprocess")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (priorParameters) 
  {
      if (class(priorParameters$mu0) != "matrix") {
          priorParameters$mu0 <- matrix(priorParameters$mu0, nrow = 1)
      }
      mdObj <- MixingDistribution("mvnormal2", priorParameters, 
          "nonconjugate")
      return(mdObj)
  }
  <bytecode: 0x4b7f398>
  <environment: namespace:dirichletprocess>
   --- function search by body ---
  Function Mvnormal2Create in namespace dirichletprocess has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 4. Error: Multivariate Normal Posterior Draw (@test_mvnormal_semi_conjugate.R
  the condition has length > 1
  Backtrace:
   1. dirichletprocess::Mvnormal2Create(pp)
  
  Accept Ratio:  2 
  Accept Ratio:  2 
  Accept Ratio:  0.03 
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dirichletprocess
   --- call from context --- 
  postFunc(matrix(c(0, 0), ncol = 2))
   --- call from argument --- 
  if (class(y) %in% c("matrix", "data.frame")) {
      out <- numeric(nrow(y))
      y <- as.matrix(y)
  } else {
      out <- numeric(length(y))
  }
   --- R stacktrace ---
  where 1 at testthat/test_posterior.R#60: postFunc(matrix(c(0, 0), ncol = 2))
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test_posterior.R#52: test_that("Posterior Function: MvNormal", {
      y <- mvtnorm::rmvnorm(10, c(0, 0), diag(2))
      dp <- DirichletProcessMvnormal(y)
      dp <- Fit(dp, 1, FALSE, FALSE)
      postFunc <- PosteriorFunction(dp)
      postFuncEval <- postFunc(matrix(c(0, 0), ncol = 2))
      expect_is(postFunc, "function")
      expect_is(postFuncEval, "numeric")
      expect_equal(length(postFuncEval), 1)
  })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 40: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 41: test_check("dirichletprocess")
  
   --- value of length: 2 type: logical ---
  [1]  TRUE FALSE
   --- function from context --- 
  function (y) 
  {
      if (class(y) %in% c("matrix", "data.frame")) {
          out <- numeric(nrow(y))
          y <- as.matrix(y)
      }
      else {
          out <- numeric(length(y))
      }
      cumWeight <- 0
      for (i in seq_along(weights)) {
          if (cumWeight > (1 - 1e-06)) {
              break
          }
          cl_params <- vector("list", length = length(params))
          for (j in seq_along(params)) {
              cl_params[[j]] <- params[[j]][, , i, drop = FALSE]
          }
          out <- out + weights[i] * func(y, cl_params)
          cumWeight <- cumWeight + weights[i]
      }
      return(out)
  }
  <bytecode: 0x4d23930>
  <environment: 0x7b68040>
   --- function search by body ---
   ----------- END OF FAILURE REPORT -------------- 
  -- 5. Error: Posterior Function: MvNormal (@test_posterior.R#60)  --------------
  the condition has length > 1
  Backtrace:
   1. dirichletprocess:::postFunc(matrix(c(0, 0), ncol = 2))
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  dirichletprocess
   --- call from context --- 
  test_weighted_func(as.matrix(0))
   --- call from argument --- 
  if (class(y) %in% c("matrix", "data.frame")) {
      out <- numeric(nrow(y))
      y <- as.matrix(y)
  } else {
      out <- numeric(length(y))
  }
   --- R stacktrace ---
  where 1: test_weighted_func(as.matrix(0))
  where 2: eval_bare(expr, quo_get_env(quo))
  where 3: quasi_label(enquo(object), label, arg = "object")
  where 4 at testthat/test_utilities.R#14: expect_equivalent(test_weighted_func(as.matrix(0)), dnorm(0))
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_utilities.R#4: test_that("Weighted Function Generator", {
      test_func <- function(x, theta) dnorm(x, theta[[1]], theta[[2]])
      test_params <- list(array(0, dim = c(1, 1, 1)), array(1, 
          dim = c(1, 1, 1)))
      test_weighted_func <- weighted_function_generator(test_func, 
          1, test_params)
      expect_is(test_weighted_func, "function")
      expect_equal(test_weighted_func(0), dnorm(0))
      expect_equivalent(test_weighted_func(as.matrix(0)), dnorm(0))
      expect_equivalent(test_weighted_func(as.data.frame(0)), dnorm(0))
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("dirichletprocess")
  
   --- value of length: 2 type: logical ---
  [1]  TRUE FALSE
   --- function from context --- 
  function (y) 
  {
      if (class(y) %in% c("matrix", "data.frame")) {
          out <- numeric(nrow(y))
          y <- as.matrix(y)
      }
      else {
          out <- numeric(length(y))
      }
      cumWeight <- 0
      for (i in seq_along(weights)) {
          if (cumWeight > (1 - 1e-06)) {
              break
          }
          cl_params <- vector("list", length = length(params))
          for (j in seq_along(params)) {
              cl_params[[j]] <- params[[j]][, , i, drop = FALSE]
          }
          out <- out + weights[i] * func(y, cl_params)
          cumWeight <- cumWeight + weights[i]
      }
      return(out)
  }
  <bytecode: 0x4d23930>
  <environment: 0x158c1150>
   --- function search by body ---
   ----------- END OF FAILURE REPORT -------------- 
  -- 6. Error: Weighted Function Generator (@test_utilities.R#14)  ---------------
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equivalent(...)
   4. dirichletprocess:::test_weighted_func(as.matrix(0))
  
  == testthat results  ===========================================================
  [ OK: 445 | SKIPPED: 7 | WARNINGS: 0 | FAILED: 6 ]
  1. Error: Mixture Object Create (@test_mvnormal_semi_conjugate.R#10) 
  2. Error: Multivariate Normal Likelihood (@test_mvnormal_semi_conjugate.R#17) 
  3. Error: Multivariate Normal Prior Draw (@test_mvnormal_semi_conjugate.R#32) 
  4. Error: Multivariate Normal Posterior Draw (@test_mvnormal_semi_conjugate.R#49) 
  5. Error: Posterior Function: MvNormal (@test_posterior.R#60) 
  6. Error: Weighted Function Generator (@test_utilities.R#14) 
  
  Error: testthat unit tests failed
  Execution halted