expect_length

Container length assertion

Passes if the length/size/row-count of x equals n. Supports Vector, List, String, DataFrame (row count), and Dict (entry count).

Parameters

Returns

Expect_pass when length matches; Expect_hold on NA; Expect_stop on errors or mismatch.

Examples

assert(expect_length([1, 2, 3], 3))
assert(expect_length("hello", 5))

See Also

expect_ncol, expect_nrow