tests/testthat/test_make_graph.R

library(delayed)
library(testthat)

context("make_graph")

test_that("can plot graph", {
  adder <- function(x, y) {
    x + y
  }
  # wrap a function to delay its evalaution
  delayed_adder <- delayed_fun(adder)

  # nest delayed objects
  z <- delayed_adder(3, 4)
  z2 <- delayed_adder(z, 4)
  z2$sequential <- TRUE
  z3 <- delayed_adder(z2, z)
  plot(z3)
})

Try the delayed package in your browser

Any scripts or data that you put into this service are public.

delayed documentation built on Oct. 20, 2022, 1:06 a.m.