context("test-gill09_harmonicity")
test_that("regression tests: dyads", {
df <- read.csv(system.file("reformatted-data/dyads.csv", package = "bowl18"),
stringsAsFactors = FALSE)
chords <- purrr::pmap(list(df$pc_1, df$pc_2), ~ hrep::pi_chord(c(..1, ..2)))
for (i in seq_along(chords)) {
expect_equal(df$bowling_harm_sim[i],
gill09_harmonicity(chords[[i]]),
tolerance = 1e-3)
}
})
test_that("regression tests: triads", {
df <- read.csv(system.file("reformatted-data/triads.csv", package = "bowl18"),
stringsAsFactors = FALSE)
chords <- purrr::pmap(list(df$pc_1, df$pc_2, df$pc_3),
~ hrep::pi_chord(c(..1, ..2, ..3)))
set.seed(1)
ind <- sample(length(chords), size = 20L)
for (i in ind) {
expect_equal(df$bowling_harm_sim[i],
gill09_harmonicity(chords[[i]]),
tolerance = 1e-3)
}
})
test_that("regression tests: tetrads", {
df <- read.csv(system.file("reformatted-data/tetrads.csv", package = "bowl18"),
stringsAsFactors = FALSE)
chords <- purrr::pmap(list(df$pc_1, df$pc_2, df$pc_3, df$pc_4),
~ hrep::pi_chord(c(..1, ..2, ..3, ..4)))
set.seed(1)
ind <- sample(length(chords), size = 20L)
for (i in ind) {
expect_equal(df$bowling_harm_sim[i],
gill09_harmonicity(chords[[i]]),
tolerance = 1e-3)
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.