Skip to content

Commit

Permalink
Update derive_basic_rap_scores unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ldavies99 committed Nov 15, 2023
1 parent 43fd749 commit 15c4ea1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test-derive_basic_rap_scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ dummy_data <- data.frame(code_freq = c("Never", rep("Sometimes", 4)),
prac_open_source_own = c(NA, "All the time", "Regularly", "Sometimes", "Rarely"),
prac_version_control = c(NA, "Never" ,"All the time", "Regularly", "Sometimes"),
prac_review = c(NA, "Rarely", "Never", "All the time", "Regularly"),
prac_AQUA_book = c(NA, "Sometimes", "Rarely", "Never", "All the time"),
prac_development_QA = c(NA, "Sometimes", "Rarely", "Never", "All the time"),
doc_readme = c(NA, "Regularly", "Sometimes", "Rarely", "Never"),
doc_comments = c(NA, "All the time", "Regularly", "Sometimes", "Rarely"))

test_that("derive_basic_rap_scores validation works", {

dummy_data <- data.frame()

expect_error(derive_basic_rap_scores(dummy_data), "Unexpected input - missing column names: code_freq\nprac_use_open_source\nprac_open_source_own\nprac_version_control\nprac_review\nprac_AQUA_book\ndoc_comments\ndoc_readme")
expect_error(derive_basic_rap_scores(dummy_data), "Unexpected input - missing column names: code_freq\nprac_use_open_source\nprac_open_source_own\nprac_version_control\nprac_review\nprac_development_QA\ndoc_comments\ndoc_readme")

})

Expand All @@ -24,14 +24,14 @@ test_that("derive_basic_rap_scores output is as expected", {
prac_open_source_own = c(NA, "All the time", "Regularly", "Sometimes", "Rarely"),
prac_version_control = c(NA, "Never" ,"All the time", "Regularly", "Sometimes"),
prac_review = c(NA, "Rarely", "Never", "All the time", "Regularly"),
prac_AQUA_book = c(NA, "Sometimes", "Rarely", "Never", "All the time"),
prac_development_QA = c(NA, "Sometimes", "Rarely", "Never", "All the time"),
doc_readme = c(NA, "Regularly", "Sometimes", "Rarely", "Never"),
doc_comments = c(NA, "All the time", "Regularly", "Sometimes", "Rarely"),
use_open_source_score = c(NA, 1, 0, 0, 0),
open_code_score = c(NA, 1, 1, 0, 0),
version_control_score = c(NA, 0, 1, 1, 0),
peer_review_score = c(NA, 0, 0, 1, 1),
AQUA_book_score = c(NA, 0, 0, 0, 1),
development_QA_score = c(NA, 0, 0, 0, 1),
doc_score = c(NA, 1, 0, 0, 0),
basic_rap_score = c(NA, 3, 2, 2, 2))

Expand Down

0 comments on commit 15c4ea1

Please sign in to comment.