Skip to content

Commit

Permalink
tests: more computation time reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
lschneiderbauer committed Jun 13, 2024
1 parent 382753a commit bb16c5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/fcwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{
"type": "double",
"attributes": {},
"value": [0.00818563, 0.01381119, 0.93018182, 0.17885428, 0.01537488, 0.00349228, 0.00349228, 0.93141165, 0.17830695, 0.01530838, 0.00229511, 0.00229511, 0.93141151, 0.17830554, 0.01530869, 0.00186936, 0.00186936, 0.93141234, 0.17830244, 0.01530983, 0.00171126, 0.00171126, 0.9314126, 0.17829282, 0.01531048, 0.00171128, 0.00171128, 0.9314126, 0.17829282, 0.01531048, 0.00186942, 0.00186942, 0.93141231, 0.17830244, 0.01530983, 0.00229525, 0.00229525, 0.93141148, 0.17830554, 0.01530869, 0.00349277, 0.00349277, 0.93141162, 0.17830695, 0.01530838, 0.0081867, 0.01381333, 0.93018151, 0.1788544, 0.0153749]
"value": ["NA", "NA", "NA", 0.24408354, 0.04113534, "NA", "NA", 0.90401391, 0.1932102, 0.01278569, "NA", 0.20598338, 0.92832275, 0.17558177, 0.01510695, "NA", 0.17118177, 0.93134681, 0.17609322, 0.015284, "NA", 0.1629128, 0.93143591, 0.17640332, 0.01511157, "NA", 0.16297441, 0.93145296, 0.17641085, 0.01510703, "NA", 0.17073316, 0.93138834, 0.17609582, 0.01528122, "NA", 0.20606514, 0.92847471, 0.17559176, 0.01511296, "NA", "NA", 0.90505214, 0.19240545, 0.0128751, "NA", "NA", "NA", 0.2424084, 0.03776317]
}

14 changes: 7 additions & 7 deletions tests/testthat/test-fcwt.R
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
test_that("fcwt() returns a vector of expected length", {
expect_length(
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 1000,
n_freqs = 10,
sigma = 1
),
44100 * 10
1000 * 10
)

expect_length(
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 1000,
n_freqs = 10,
sigma = 10
),
44100 * 10
1000 * 10
)
})

test_that("fcwt() optional arguments do work", {
expect_no_error(
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
n_freqs = 10
)
Expand All @@ -37,7 +37,7 @@ test_that("fcwt() optional arguments do work", {
test_that("fcwt() errs if frequency specs are higher than Nyquist frequency", {
expect_error(
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 25000,
Expand All @@ -51,7 +51,7 @@ test_that("fcwt() result does not change", {
res <-
as.data.frame(
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 1000,
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-fcwtr_scalogram.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("tbind() for fcwtr_scalogram", {
first <-
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 1000,
Expand All @@ -11,7 +11,7 @@ test_that("tbind() for fcwtr_scalogram", {

second <-
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 1000,
Expand All @@ -21,7 +21,7 @@ test_that("tbind() for fcwtr_scalogram", {

third <-
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 22100,
freq_begin = 50,
freq_end = 1000,
Expand Down Expand Up @@ -52,7 +52,7 @@ test_that("ggplot2::autoplot() does not err", {

res <-
fcwt(
ts_sin_440,
ts_sin_440[1:1000],
sample_freq = 44100,
freq_begin = 50,
freq_end = 1000,
Expand Down

0 comments on commit bb16c5e

Please sign in to comment.