Skip to contents

Wraps daf in a fresh contractor() call using contract, then runs verify_input() and verify_output(). Errors early with a diagnostic on contract violation; returns invisible(daf) on success.

Usage

verify_contract(contract, daf)

Arguments

contract

A Contract().

daf

A DafReader.

Value

Invisibly daf.

Examples

withr::with_options(list(dafr.enforce_contracts = TRUE), {
    d <- memory_daf()
    add_axis(d, "cell", c("c1", "c2"))
    set_vector(d, "cell", "donor", c("A", "B"))
    c <- create_contract(
        axes = list(axis_contract("cell", RequiredInput, "per-cell axis")),
        vectors = list(contract_vector("cell", "donor", RequiredInput,
            "character", "donor id"))
    )
    verify_contract(c, d)
})