tests/testthat/test_NMwriteSectionOne.R

context("NMwriteSectionOne")

test_that("basic",{

    file.mod="testData/nonmem/xgxr011.mod"
    
    newlines <- "$INPUT ROW ID TIME EVID CMT"
    section <- "INPUT"


    lines <- readLines(file.mod,warn=FALSE)

    newmod <- NMwriteSectionOne(lines=lines
                               ,section=section
                               ,newlines=newlines
                                )
    
    res <- NMreadSection(lines=newmod,section=section)
    expect_equal(res,newlines)

})

test_that("section not matched",{

    file.mod="testData/nonmem/xgxr011.mod"
    
    newlines <- "$INPUT ROW ID TIME EVID CMT"
    section <- "INPUTTTTT"


    lines <- readLines(file.mod,warn=FALSE)

    newmod <- NMwriteSectionOne(lines=lines
                               ,section=section
                               ,newlines=newlines
                                )
    
    res <- NMreadSection(lines=newmod,section=section)
    
    expect_null(res)

})

Try the NMdata package in your browser

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

NMdata documentation built on Nov. 5, 2025, 5:43 p.m.