Tests
Fix the Code 3
This is a follow up to Fix the Code 2.
Write tests for your ‘Fix the Code 2’ code for the following cases and save it in a
file called Tests-R.R
. Make corrections/improvements to the ‘Fix the Code 2’ code
so that all of your tests pass.
test_that("get_gc_content() works",
- on a sequence represented by upper case string.
- on a sequence represented by lower case string.
- on a sequence represented by mixed case string.
- on a sequence represented by multiline string.
In an email accompanying your “updated” code, Dr. Granger indicated that
the specifications for the earlength size classes were:
- extralarge: earlength >= 15
- large: 10 <= earlength < 15
- medium: 8 <= earlength < 10
- small: earlength < 8
test_that("get_size_class() works",
- for each case when the numbers are in the range.
- for the edgecases of 8, 10, and 15.
- but the function fails if non-numerical values are input as an argument
(e.g., a string from a header row that didn’t get removed).
[click here for output]