Skip to content

Commit 508d4d1

Browse files
committed
improve runtests for spectrum_correlation_fft
1 parent 42c6c52 commit 508d4d1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/spectrum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function spectrum_correlation_fft(tlist::AbstractVector, corr::AbstractVector; i
164164
dt_list = diff(tlist)
165165
dt = dt_list[1]
166166

167-
all((dt), dt_list) || ArgumentError("tlist must be equally spaced for FFT.")
167+
all((dt), dt_list) || throw(ArgumentError("tlist must be equally spaced for FFT."))
168168

169169
# power spectrum list
170170
F = inverse ? N * ifft(corr) : fft(corr)

test/core-test/correlations_and_spectrum.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
end
3636

3737
# tlist and τlist checks
38+
t_fft_wrong = [0, 1, 10]
3839
t_wrong1 = [1, 2, 3]
3940
t_wrong2 = [-1, 0, 1]
41+
@test_throws ArgumentError spectrum_correlation_fft(t_fft_wrong, corr1)
4042
@test_throws ArgumentError correlation_3op_2t(H, nothing, t_l, t_wrong1, c_ops, Id, a', a)
4143
@test_throws ArgumentError correlation_3op_2t(H, nothing, t_l, t_wrong2, c_ops, Id, a', a)
4244
@test_throws ArgumentError correlation_3op_2t(H, nothing, t_wrong1, t_l, c_ops, Id, a', a)

0 commit comments

Comments
 (0)