test_function: evaluate Correctness of a function

View source: R/test_function.R

test_functionR Documentation

evaluate Correctness of a function

Description

convert each row of a dataframe to a list of arguments.

Usage

test_function(test_dat ,studentFUN ,correctFUN)

Arguments

test_dat

A dataframe that contains the test cases, where each row is one test case.

studentFUN

The function to be tested

correctFUN

Function to be tested against

Value

The function returns a list of lists containing the argiuments to be tested on.

Examples

test1 <- function(x,y)x
test2 <- function(x,y) y + x
correct <- function(a,b) a + b
add_data <- list(list(10,20),list(0,-3))
(test_function(add_data, test1, correct))
(test_function(add_data, test2, correct))

oonyambu/stats_102A documentation built on Jan. 23, 2025, 4:03 a.m.