-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding (very simple) tests for
encounter_creator
and reroll
funct…
…ions (input testing handled by tests of upstream functions so only output testing is needed)
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Run all tests in this script: | ||
## testthat::test_file(file.path("tests", "testthat", "test-encounter_creator.R")) | ||
|
||
# # Error testing | ||
# test_that("Errors work as desired", { | ||
# All inputs received from/tested in `xp_pool` and/or `xp_cost` | ||
# }) | ||
|
||
# # Warning testing | ||
# test_that("Warnings work as desired", { | ||
# # No warnings in this function | ||
# }) | ||
|
||
# # Message testing | ||
# test_that("Messages work as desired", { | ||
# # No messages in this function | ||
# }) | ||
|
||
# Output testing | ||
test_that("Outputs are as expected", { | ||
my_battle <- encounter_creator(party_level = 10, party_size = 4, difficulty = "hard") | ||
expect_equal(class(my_battle), c("tbl_df", "tbl", "data.frame")) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Run all tests in this script: | ||
## testthat::test_file(file.path("tests", "testthat", "test-reroll.R")) | ||
|
||
# NO INPUT TESTS CURRENTLY NEEDED | ||
## `reroll` is only used inside of `roll` so it is not possible for it receive improper inputs | ||
|
||
# # Error testing | ||
# test_that("Errors work as desired", { | ||
# All inputs received from/tested in `roll` | ||
# }) | ||
|
||
# # Warning testing | ||
# test_that("Warnings work as desired", { | ||
# # No warnings in this function | ||
# }) | ||
|
||
# # Message testing | ||
# test_that("Messages work as desired", { | ||
# # No messages in this function | ||
# }) | ||
|
||
# Output testing | ||
test_that("Outputs are as expected", { | ||
new_values <- reroll(dice_faces = 1, first_result = c(1, 1, 5, 3, 6)) | ||
expect_equal(class(new_values), "numeric") | ||
}) |