Skip to content

Commit

Permalink
First basic function & test
Browse files Browse the repository at this point in the history
Closes #18
  • Loading branch information
wibeasley committed May 3, 2017
1 parent 1cb6dd1 commit c6fd4ef
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(integer_addition)
12 changes: 12 additions & 0 deletions R/integer-addition.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' @name integer_addition
#' @export
#' @title adds two integers
#' @description Adding two numbers
#' @param a first integer
#' @param b second integer

integer_addition <- function( a, b )
{
c <- a + b
return( c )
}
16 changes: 16 additions & 0 deletions man/integer_addition.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/testthat/test-all.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Modeled after the R6 testing structure: https://github.com/wch/R6/blob/master/tests/testthat.R
library(testthat)
library(rpackageskeleton)

testthat::test_check("rpackageskeleton")
15 changes: 15 additions & 0 deletions tests/testthat/test-integer-addition.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
library(testthat)
context("Integer addition")

test_that("smoke-test", {
returned <- integer_addition(3,5)
expect_true(!is.null(returned))
})

test_that("vector-test", {
a <- 5:10
b <- -16:-11
expected <- -1L
returned <- integer_addition(3:6)
expect_equal(returned, expected)
})

0 comments on commit c6fd4ef

Please sign in to comment.