tests/testthat/test-cable.R

test_that("total_cable and seglengths work", {
  sls=c(84.1981006598972, 13.6763252379112, 9.83787545930052, 4.49985808800934,
        11.8042856800186, 2.33971280684251, 24.347902927967, 3.01814475983706,
        1.47034808957755, 4.45486982075313, 23.2051909267716, 1.51610077059617,
        5.17101984894129, 2.1631493847182, 0.627301057284621, 3.95066366227845,
        16.5702881987843, 2.07366794706829, 3.41086754318633, 4.54376209562091,
        1.9431903948992, 3.02654128566312, 1.52500605301188, 12.8007561600796,
        1.15386575694672, 10.9149576666029, 6.86103279192155, 7.64657081283957,
        8.04496693795738, 4.86607708854949, 3.73564577584504, 1.95717022952378,
        9.82104720169453)
  n=readRDS(test_path('testdata/cell071.rds'))
  expect_equal(c_seglengths(n$SegList, n$d$X, n$d$Y, n$d$Z), sls, tolerance = 1e-8)
  expect_equal(c_total_cable(n$SegList, n$d$X, n$d$Y, n$d$Z), sum(sls), tolerance = 1e-8)
})

Try the natcpp package in your browser

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

natcpp documentation built on July 13, 2021, 5:09 p.m.