tests/testthat/test-tree.R

suppressPackageStartupMessages(library(testthat))
test_that("Walking json tree", {
    # Read wheat.json
    wheat <- read_apsimx(system.file("Wheat.json", package = "rapsimng"))

    a <- search_node(wheat, Name = "Simulations")
    expect_error(get_parent(wheat, 1))

    # Level four
    a <- search_path(wheat, '[Structure].BranchingRate')
    b <- get_parent(wheat, a$path)
    expect_equal(b$node$Name, "Structure")
    expect_equal(b$path, c(1, 1, 4))
})

Try the rapsimng package in your browser

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

rapsimng documentation built on Sept. 9, 2021, 9:07 a.m.