tests/testthat/test-WS.R

describe("WS()", {
  it("can estimate the stem weight.", {
    expect_equal(WS(20, 7), 57.85323)
  })
  it("return `NA` when the diameter or height inputed is NA.", {
    expect_equal(WS(NA, 10), NA)
    expect_equal(WS(10, NA), NA)
    expect_equal(WS(NA, NA), NA)
  })
  it("return `0` when the diameter or height inputed is 0.", {
    expect_equal(WS(0, 10), 0)
    expect_equal(WS(10, 0), 0)
    expect_equal(WS(0, 0), 0)
  })
})

Try the javateak package in your browser

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

javateak documentation built on April 3, 2025, 10:44 p.m.