Add tests for R builds
This commit is contained in:
parent
69b268e6f7
commit
1de359f3e6
1 changed files with 505 additions and 0 deletions
32
test/testpkg/R/testpkg.R
Normal file
32
test/testpkg/R/testpkg.R
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#' @useDynLib testpkg, .registration = TRUE
|
||||
"_PACKAGE"
|
||||
|
||||
#' Add it together
|
||||
#'
|
||||
#' @param a Number
|
||||
#' @param b Number
|
||||
#' @return Sum of numbers
|
||||
#' @export
|
||||
add_it <- function(a, b) {
|
||||
.Call("add", a, b)
|
||||
}
|
||||
|
||||
#' Subtract it
|
||||
#'
|
||||
#' @param a Number
|
||||
#' @param b Number
|
||||
#' @return Difference of numbers
|
||||
#' @export
|
||||
subtract_it <- function(a, b) {
|
||||
.Call("subtract", a, b)
|
||||
}
|
||||
|
||||
#' Square it up
|
||||
#'
|
||||
#' @param n Integer
|
||||
#' @return Square
|
||||
#' @export
|
||||
square_it <- function(n) {
|
||||
result <- .Fortran("square", n = as.integer(n), answer = as.integer(1))
|
||||
result$answer
|
||||
}
|
||||
Loading…
Reference in a new issue