tests/testthat/test_cpp_api.R

library(imager)
library(Rcpp)

test_that("cpp_plugin",{

    foo.inline <- "
NumericVector foo(NumericVector inp)
{
    CImg<double> img = as<CImg<double> >(inp);
    img.blur(3).erode(2);
    return wrap(img);
} "
    Sys.setenv("R_TESTS" = "") #Workaround for obscure bug in testthat
cppFunction(foo.inline,depends="imager")
im <- grayscale(boats)
expect_equal(im %>% isoblur(3) %>% erode_square(2),foo(im))
})

Try the imager package in your browser

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

imager documentation built on May 29, 2017, 8:46 p.m.