"Assertion on 'c(unlist(trt), outcome, baseline, unlist(time_vary), cens, id)' failed: Must be a subset of {'L1','A1','C1','L2','A2','C2','Y'}, but has additional elements {'A'}."
"Assertion on 'time_vary' failed: Must be of type 'list' (or 'NULL'), not 'character'."
"Only 0 and 1 in 'outcome' when binary or surival"
"Issues with 'outcome_type' being or not being survival"
"Issues with 'shift' function and providing 'shifted' data"

# the function should either be vectorized or iterate over the rows
if (trt == "A1") { # if the first time point set to 1
(data[["L"]] > 0)*1 + (data[["L"]] <= 0)*0 # else return 1 or 0 based on L
if (trt == "A1") return(rep(1, nrow(data)))
# test adapted from the ltmle package vignette for a dynamic intervention example with censoring
rexpit <- function(x) rbinom(n = length(x), size = 1, prob = plogis(x))
L[uncensored] <- (0.3 * W[uncensored] + 0.2 * A1[uncensored] + rnorm(sum(uncensored)))
A2[uncensored] <- rexpit(W[uncensored] + A1[uncensored] + L[uncensored])
Y[uncensored] <- rexpit(W[uncensored] - 0.6 * A1[uncensored] + L[uncensored] - 0.8 * A2[uncensored])
sim <- data.frame(W, A1, C1, L, A2, C2, Y)
tml.stc <- sw(lmtp_tmle(sim, a, "Y", baseline, nodes, cens, shift = static_binary_on, folds = 1))
sdr.stc <- sw(lmtp_sdr(sim, a, "Y", baseline, nodes, cens, shift = static_binary_off, folds = 1))
tml.tv <- sw(lmtp_tmle(sim, a, "Y", baseline, nodes, cens, shift = time_vary_on, folds = 1))
sdr.tv <- sw(lmtp_sdr(sim, a, "Y", baseline, nodes, cens, shift = time_vary_on, folds = 1))
tml.dyn <- sw(lmtp_tmle(sim, a, "Y", baseline, nodes, cens, shift = dynamic_vec, folds = 1))
sdr.dyn <- sw(lmtp_sdr(sim, a, "Y", baseline, nodes, cens, shift = dynamic_vec, folds = 1))
expect_equal(0.308, tml.stc$theta, tolerance = 0.1)
expect_equal(0.528, sdr.stc$theta, tolerance = 0.1)
expect_equal(0.433, tml.tv$theta, tolerance = 0.1)
expect_equal(0.433, sdr.tv$theta, tolerance = 0.1)
expect_equal(0.345, tml.dyn$theta, tolerance = 0.1)
expect_equal(0.345, sdr.dyn$theta, tolerance = 0.1)

context("Fidelity of estimators for a point treatment")
tmp <- data.frame(W1, W2, A, Y, Y.1, Y.0)
sub <- lmtp_sub(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on, folds = 1)
ipw <- lmtp_ipw(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on, folds = 1)
tmle <- lmtp_tmle(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on, folds = 1)
sdr <- lmtp_sdr(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on, folds = 1)
expect_equal(truth, sub$theta, tolerance = 0.025)
expect_equal(truth, ipw$theta, tolerance = 0.025)
expect_equal(truth, tmle$theta, tolerance = 0.025)
expect_equal(truth, sdr$theta, tolerance = 0.025)