Skip to content

Commit b236624

Browse files
committed
Add check_args example and build docs
1 parent 2f63f96 commit b236624

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

R/check-function.R

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
#' can be used.
66
#'
77
#' @param state state to start from
8-
#' @param name name of the function/operator as a string, e.g. \code{"mean"},
9-
#' \code{"+"} or \code{"..."}; can also be used for positional access, e.g.
10-
#' \code{1} for the first argument and \code{"..1"} for the first item in
11-
#' \code{"..."}
8+
#' @param name name of the function/operator as a string, e.g. \code{"mean"} or
9+
#' \code{"+"}
1210
#' @param index integer that specifies which call of \code{name} in the
1311
#' solution code will be checked.
1412
#' @param eval logical vector indicating whether and how to compare arguments.
@@ -37,7 +35,7 @@
3735
#' @param arg_not_specified_msg custom message in case argument was not
3836
#' specified (for \code{check_arg})
3937
#' @param arg name or position of argument to specify
40-
#' ... Arguments can be accessed using '..<INDEX>' (see example 4) (for \code{check_arg})
38+
#' ... Arguments can be accessed using '..<INDEX>' (see example 5) (for \code{check_arg})
4139
#'
4240
#' @examples
4341
#' \dontrun{
@@ -62,8 +60,17 @@
6260
#' # SCT
6361
#' ex() %>% check_operator("+") %>% check_result() %>% check_equal()
6462
#' }
63+
#'
64+
#' # Example 4: Positional argument check
65+
#' cor(rnorm(10), rnorm(10))
66+
#'
67+
#' # SCT
68+
#' ex() %>% check_function("cor") %>% {
69+
#' check_arg(., 1) %>% check_equal()
70+
#' check_arg(., 2) %>% check_equal()
71+
#' }
6572
#'
66-
#' # Example 4: ... in check_args
73+
#' # Example 5: ... in check_args
6774
#'
6875
#'soln <- "std_dev <- purrr::compose(sqrt, var, .dir='forward')"
6976
#'state <- setup_state(soln, soln)

man/check_function.Rd

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/check_logic.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)