-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add skip_on_cran to all unit tests in effort to appease CRAN gods
- Loading branch information
Showing
12 changed files
with
150 additions
and
90 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
library(testthat) | ||
skip_on_cran() | ||
|
||
test_check("phonics") |
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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
context("caverphone") | ||
|
||
## Test the Caverphone algorithm | ||
test <- read.csv("caverphone.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(caverphone(test$word[i]) == test$value[i]) | ||
test$test <- caverphone(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("Caverphone works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("caverphone.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(caverphone(test$word[i]) == test$value[i]) | ||
test$test <- caverphone(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) | ||
|
||
## Test the Caverphone 2 algorithm | ||
test <- read.csv("caverphone-modified.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(caverphone(test$word[i], modified = TRUE) == test$value[i]) | ||
test$test <- caverphone(test$word, modified = TRUE) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("Caverphone works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("caverphone-modified.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(caverphone(test$word[i], modified = TRUE) == test$value[i]) | ||
test$test <- caverphone(test$word, modified = TRUE) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
context("cologne") | ||
|
||
## Test the Cologne algorithm | ||
test <- read.csv("cologne.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
test_that("Cologne works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("cologne.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(cologne(test$word[i]) == test$value[i]) | ||
test$test <- cologne(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test$test <- cologne(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
context("lein") | ||
|
||
## Test the lein algorithm | ||
test <- read.csv("lein.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(lein(test$word[i]) == test$value[i]) | ||
test$test <- lein(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("Lein works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("lein.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(lein(test$word[i]) == test$value[i]) | ||
test$test <- lein(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
context("metaphone") | ||
|
||
test_that("The metaphone algorithm implementation accurately maps strings to metaphones", { | ||
test_data <- read.csv("metaphone.csv", comment.char = "#", stringsAsFactors = FALSE) | ||
expect_true(all(metaphone(test_data$word) == test_data$value)) | ||
test_data$test_metaphones <- metaphone(test_data$word) | ||
expect_true(all(test_data$test_metaphones == test_data$value)) | ||
skip_on_cran() | ||
|
||
test_data <- read.csv("metaphone.csv", comment.char = "#", stringsAsFactors = FALSE) | ||
expect_true(all(metaphone(test_data$word) == test_data$value)) | ||
test_data$test_metaphones <- metaphone(test_data$word) | ||
expect_true(all(test_data$test_metaphones == test_data$value)) | ||
}) | ||
|
||
test_that("The metaphone algorithm implementation can handle NAs", { | ||
test_data <- metaphone(NA_character_) | ||
expect_true(is.na(test_data)) | ||
skip_on_cran() | ||
|
||
test_data <- metaphone(NA_character_) | ||
expect_true(is.na(test_data)) | ||
}) |
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
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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
context("nysiis") | ||
|
||
## Test the NYSIIS algorithm | ||
test <- read.csv("nysiis.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(nysiis(test$word[i]) == test$value[i]) | ||
test$test <- nysiis(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("NYSIIS works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("nysiis.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(nysiis(test$word[i]) == test$value[i]) | ||
test$test <- nysiis(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) | ||
|
||
## Test the modified NYSIIS algorithm | ||
test <- read.csv("nysiis-modified.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(nysiis(test$word[i], modified = TRUE) == test$value[i]) | ||
test$test <- nysiis(test$word, modified = TRUE) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("Modified NYSIIS works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("nysiis-modified.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(nysiis(test$word[i], modified = TRUE) == test$value[i]) | ||
test$test <- nysiis(test$word, modified = TRUE) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
context("onca") | ||
|
||
## Test the ONCA algorithm | ||
test <- read.csv("onca.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(onca(test$word[i]) == test$value[i]) | ||
test$test <- onca(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("ONCA works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("onca.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(onca(test$word[i]) == test$value[i]) | ||
test$test <- onca(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
context("phonex") | ||
|
||
## Test the Phonex algorithm | ||
test <- read.csv("phonex.csv", comment.char="#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(phonex(test$word[i]) == test$value[i]) | ||
test$test <- phonex(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("Phonex works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("phonex.csv", comment.char="#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(phonex(test$word[i]) == test$value[i]) | ||
test$test <- phonex(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
context("rogerroot") | ||
|
||
## Test the Roger Root name encoding | ||
test <- read.csv("rogerroot.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(rogerroot(test$word[i]) == test$value[i]) | ||
test$test <- rogerroot(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("RogerRoot works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("rogerroot.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(rogerroot(test$word[i]) == test$value[i]) | ||
test$test <- rogerroot(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |
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 |
---|---|---|
@@ -1,25 +1,33 @@ | ||
context("soundex") | ||
|
||
test_that("The soundex algorithm implementation accurately maps strings to soundexes", { | ||
test_data <- read.csv("soundex.csv", comment.char = "#", stringsAsFactors = FALSE) | ||
expect_true(all(soundex(test_data$word) == test_data$value)) | ||
test_data$test_soundexes <- soundex(test_data$word) | ||
expect_true(all(test_data$test_soundexes == test_data$value)) | ||
skip_on_cran() | ||
|
||
test_data <- read.csv("soundex.csv", comment.char = "#", stringsAsFactors = FALSE) | ||
expect_true(all(soundex(test_data$word) == test_data$value)) | ||
test_data$test_soundexes <- soundex(test_data$word) | ||
expect_true(all(test_data$test_soundexes == test_data$value)) | ||
}) | ||
|
||
test_that("The soundex algorithm implementation can handle NAs", { | ||
test_data <- soundex(NA_character_) | ||
expect_true(is.na(test_data)) | ||
skip_on_cran() | ||
|
||
test_data <- soundex(NA_character_) | ||
expect_true(is.na(test_data)) | ||
}) | ||
|
||
test_that("The refined soundex algorithm implementation accurately maps strings to soundexes", { | ||
test_data <- read.csv("soundex-refined.csv", comment.char = "#", stringsAsFactors = FALSE) | ||
expect_true(all(refinedSoundex(test_data$word) == test_data$value)) | ||
test_data$test_soundexes <- refinedSoundex(test_data$word) | ||
expect_true(all(test_data$test_soundexes == test_data$value)) | ||
skip_on_cran() | ||
|
||
test_data <- read.csv("soundex-refined.csv", comment.char = "#", stringsAsFactors = FALSE) | ||
expect_true(all(refinedSoundex(test_data$word) == test_data$value)) | ||
test_data$test_soundexes <- refinedSoundex(test_data$word) | ||
expect_true(all(test_data$test_soundexes == test_data$value)) | ||
}) | ||
|
||
test_that("The refined soundex algorithm implementation can handle NAs", { | ||
test_data <- refinedSoundex(NA_character_) | ||
expect_true(is.na(test_data)) | ||
skip_on_cran() | ||
|
||
test_data <- refinedSoundex(NA_character_) | ||
expect_true(is.na(test_data)) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
context("statcan") | ||
|
||
## Test the statcan algorithm | ||
test <- read.csv("statcan.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(statcan(test$word[i]) == test$value[i]) | ||
test$test <- statcan(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
test_that("StatCan works", { | ||
skip_on_cran() | ||
|
||
test <- read.csv("statcan.csv", comment.char = "#", stringsAsFactors = FALSE, colClasses = c("character", "character"), encoding = "UTF-8") | ||
for(i in 1:nrow(test)) | ||
expect_true(statcan(test$word[i]) == test$value[i]) | ||
test$test <- statcan(test$word) | ||
for(i in 1:nrow(test)) | ||
expect_true(test$test[i] == test$value[i]) | ||
}) |