Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CHCRowley committed Dec 19, 2023
1 parent 1c1025f commit e33dc4d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-summarise_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dummy_data <- data.frame(CI = c(NA,
rep("Yes", 2),
rep("No", 3),
rep("I don't know", 4)))
rep("I don't know what continuous integration is", 4)))

test_that("summarise_ci validation works", {

Expand All @@ -26,10 +26,10 @@ test_that("summarise_ci output is as expected", {

expected <- data.frame(value = factor(c("Yes",
"No",
"I don't know"),
"I don't know what continuous integration is"),
levels = c("Yes",
"No",
"I don't know")),
"I don't know what continuous integration is")),
n = c(2/9, 1/3, 4/9))

expect_equal(got, expected)
Expand Down
40 changes: 20 additions & 20 deletions tests/testthat/test-summarise_coding_tools.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Coding tools frequency tables (access or knowledge)

dummy_data <- data.frame(
knowledge_R = c("Yes", rep("No", 2), rep("Don't Know", 3)),
access_R = c(rep("Yes", 2), "No", rep("Don't Know", 3)),
knowledge_SQL = c(rep("Yes", 3), rep("No", 2), "Don't Know"),
access_SQL = c("Yes", rep("No", 3), rep("Don't Know", 2)),
knowledge_SAS = c(rep("Yes", 2), rep("No", 3), "Don't Know"),
access_SAS = c(rep("Yes", 3), "No", rep("Don't Know", 2)),
knowledge_VBA = c("Yes", rep("No", 2), rep("Don't Know", 3)),
access_VBA = c(rep("Yes", 2), "No", rep("Don't Know", 3)),
knowledge_python = c(rep("Yes", 3), rep("No", 2), "Don't Know"),
access_python = c("Yes", rep("No", 3), rep("Don't Know", 2)),
knowledge_SPSS = c(rep("Yes", 2), rep("No", 3), "Don't Know"),
access_SPSS = c(rep("Yes", 3), "No", rep("Don't Know", 2)),
knowledge_stata = c("Yes", rep("No", 2), rep("Don't Know", 3)),
access_stata = c(rep("Yes", 2), "No", rep("Don't Know", 3)),
knowledge_matlab = c(rep("Yes", 3), rep("No", 2), "Don't Know"),
access_matlab = c("Yes", rep("No", 5), rep("Don't Know", 0)) # Used to check zero counts aren't missing
knowledge_R = c("Yes", rep("No", 2), rep("Don't know", 3)),
access_R = c(rep("Yes", 2), "No", rep("Don't know", 3)),
knowledge_SQL = c(rep("Yes", 3), rep("No", 2), "Don't know"),
access_SQL = c("Yes", rep("No", 3), rep("Don't know", 2)),
knowledge_SAS = c(rep("Yes", 2), rep("No", 3), "Don't know"),
access_SAS = c(rep("Yes", 3), "No", rep("Don't know", 2)),
knowledge_VBA = c("Yes", rep("No", 2), rep("Don't know", 3)),
access_VBA = c(rep("Yes", 2), "No", rep("Don't know", 3)),
knowledge_python = c(rep("Yes", 3), rep("No", 2), "Don't know"),
access_python = c("Yes", rep("No", 3), rep("Don't know", 2)),
knowledge_SPSS = c(rep("Yes", 2), rep("No", 3), "Don't know"),
access_SPSS = c(rep("Yes", 3), "No", rep("Don't know", 2)),
knowledge_stata = c("Yes", rep("No", 2), rep("Don't know", 3)),
access_stata = c(rep("Yes", 2), "No", rep("Don't know", 3)),
knowledge_matlab = c(rep("Yes", 3), rep("No", 2), "Don't know"),
access_matlab = c("Yes", rep("No", 5), rep("Don't know", 0)) # Used to check zero counts aren't missing
)

test_that("summarise_coding_tools missing data is handled correctly", {
Expand All @@ -41,8 +41,8 @@ test_that("summarise_coding_tools knowledge output is as expected", {
"SQL",
"Stata",
"VBA"), each=3),
"value" = factor(rep(c("Yes", "Don't Know", "No"), 8),
levels = c("Yes", "Don't Know", "No")),
"value" = factor(rep(c("Yes", "Don't know", "No"), 8),
levels = c("Yes", "Don't know", "No")),
"n" = c(1/2, 1/6, 1/3, 1/2, 1/6, 1/3, 1/6, 1/2,
1/3, 1/3, 1/6, 1/2, 1/3, 1/6, 1/2, 1/2,
1/6, 1/3, 1/6, 1/2, 1/3, 1/6, 1/2, 1/3))
Expand All @@ -63,8 +63,8 @@ test_that("summarise_coding_tools access output is as expected", {
"SQL",
"Stata",
"VBA"), each=3),
"value" = factor(rep(c("Yes", "Don't Know", "No"), 8),
levels = c("Yes", "Don't Know", "No")),
"value" = factor(rep(c("Yes", "Don't know", "No"), 8),
levels = c("Yes", "Don't know", "No")),
"n" = c(1/6, 0, 5/6, 1/6, 1/3, 1/2, 1/3, 1/2,
1/6, 1/2, 1/3, 1/6, 1/2, 1/3, 1/6, 1/6,
1/3, 1/2, 1/3, 1/2, 1/6, 1/3, 1/2, 1/6))
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-summarise_dep_man.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dummy_data <- data.frame(dep_management = c(NA,
rep("Yes", 2),
rep("No", 3),
rep("I don't know", 4)))
rep("I don't know what dependency management is", 4)))

test_that("summarise_dep_man validation works", {

Expand All @@ -26,10 +26,10 @@ test_that("summarise_dep_man output is as expected", {

expected <- data.frame(value = factor(c("Yes",
"No",
"I don't know"),
"I don't know what dependency management is"),
levels = c("Yes",
"No",
"I don't know")),
"I don't know what dependency management is")),
n = c(2/9, 1/3, 4/9))

expect_equal(got, expected)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-summarise_languages_by_prof.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ knowledge_response <- rep(c(
NA,
"Yes",
"No",
"Don't Know"),
"Don't know"),
each = 3, times = 6)

prof_response <- rep(c(
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-summarise_rep_workflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dummy_data <- data.frame(
NA,
"Yes",
"No",
"I don't know")
"I don't know what reproducible workflows are")

)

Expand All @@ -25,10 +25,10 @@ test_that("summarise_rep_workflow output is as expected", {
value = factor(c(
"Yes",
"No",
"I don't know"),
"I don't know what reproducible workflows are"),
levels = c("Yes",
"No",
"I don't know")),
"I don't know what reproducible workflows are")),

n = rep(1/3, times = 3)

Expand Down

0 comments on commit e33dc4d

Please sign in to comment.