Skip to content

Commit

Permalink
test allocs more thoroughly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Milsted committed Jul 5, 2024
1 parent 0f68f17 commit f9bc9f8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/test_timeevolution_tdops.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
using Test
using QuantumOptics

function test_settime(op)
t = current_time(op)
set_time!(op, randn())
set_time!(op, t)
return nothing
end

@testset "time-dependent operators" begin

b = FockBasis(7)
Expand All @@ -12,11 +19,17 @@ Hd = (a + a')

# function and op types homogeneous
H = TimeDependentSum(cos=>H0, cos=>Hd)
@test timeevolution._tuplify(H) === H
Htup = timeevolution._tuplify(H)
@test Htup === H
test_settime(Htup)
@test (@allocated(test_settime)) == 0

# op types not homogeneous
H = TimeDependentSum(cos=>H0, cos=>dense(Hd))
@test timeevolution._tuplify(H) !== H
H = TimeDependentSum(cos=>H0, cos=>dense(Hd), cos=>LazySum(H0), cos=>LazySum(dense(Hd)))
Htup = timeevolution._tuplify(H)
@test Htup !== H
test_settime(Htup)
@test (@allocated(test_settime)) == 0

H = TimeDependentSum(1.0=>H0, cos=>Hd)

Expand Down

0 comments on commit f9bc9f8

Please sign in to comment.