Skip to content

Commit

Permalink
#1839 checking necessary steps
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas.eugenio committed Jul 5, 2023
1 parent 63652b7 commit a059361
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 34 deletions.
15 changes: 7 additions & 8 deletions R/my_first_fcn.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
#' welcome_fun(anything = 2)
#' welcome_fun(anything = NULL)
#' welcome_fun(anything = data.frame(1:10, 2:11))
welcome_fun <- function(anything = NULL){

if(is.null(anything)){

cat("Welcome to the admiral family!")

} else {cat("Welcome to the admiral family!")}

welcome_fun <- function(anything = NULL) {
if (is.null(anything)) {
out <- "Welcome to the admiral family!"
} else {
out <- "Welcome to the admiral family!"
}
return(out)
}
3 changes: 2 additions & 1 deletion man/derive_var_extreme_flag.Rd

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

3 changes: 2 additions & 1 deletion man/derive_var_joined_exist_flag.Rd

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

3 changes: 2 additions & 1 deletion man/derive_var_merged_exist_flag.Rd

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

3 changes: 2 additions & 1 deletion man/derive_var_merged_summary.Rd

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

3 changes: 2 additions & 1 deletion man/derive_var_obs_number.Rd

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

3 changes: 2 additions & 1 deletion man/derive_var_relative_flag.Rd

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

3 changes: 2 additions & 1 deletion man/derive_vars_joined.Rd

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

3 changes: 2 additions & 1 deletion man/derive_vars_merged.Rd

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

3 changes: 2 additions & 1 deletion man/derive_vars_merged_lookup.Rd

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

3 changes: 2 additions & 1 deletion man/derive_vars_transposed.Rd

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

3 changes: 2 additions & 1 deletion man/get_summary_records.Rd

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

24 changes: 9 additions & 15 deletions tests/testthat/test-my_first_fcn.R
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
# anything param types ----
## Test 1: param is NULL ----

test_that("my_new_func Test 1: NULL works as parameter", {

## Test 1: NULL works as parameter ----
test_that("my_first_fcn Test 1: NULL works as parameter", {
input <- NULL

expected_output <- "Welcome to the admiral family!"

expect_dfs_equal(welcome_fun(input), expected_output)

expect_equal(welcome_fun(input), expected_output)
})


## Test 2: param is double ----

test_that("my_new_func Test 2: double works as parameter", {

## Test 2: double works as parameter ----
test_that("my_first_fcn Test 2: double works as parameter", {
input <- 3

expected_output <- "Welcome to the admiral family!"

expect_dfs_equal(welcome_fun(input), expected_output)

expect_equal(welcome_fun(input), expected_output)
})

## Test 3: param is a dataframe ----

test_that("my_new_func Test 3: dataframe works as parameter", {

## Test 3: dataframe works as parameter ----
test_that("my_first_fcn Test 3: dataframe works as parameter", {
input <- tibble::tribble(
~x, ~y,
"a", 1:3,
Expand All @@ -36,6 +31,5 @@ test_that("my_new_func Test 3: dataframe works as parameter", {

expected_output <- "Welcome to the admiral family!"

expect_dfs_equal(welcome_fun(input), expected_output)

expect_equal(welcome_fun(input), expected_output)
})

0 comments on commit a059361

Please sign in to comment.