Skip to content

Commit

Permalink
test: include new tests and copy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fjebaker committed Jun 29, 2024
1 parent ad72bc7 commit 509c5ee
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/models/test-copy.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using SpectralFitting
using Test

include("../dummies.jl")

# single model
m = PowerLaw()
m2 = copy(m)
@inferred copy(m)
m.K.value = 2.0
@test m2.K.value == 1.0

# table model
m = DummyMultiplicativeTableModel()
m2 = copy(m)
@inferred copy(m)
m.a.value = 2.0
@test m2.a.value == 1.0
@test m.table === m2.table

# composite model
model = PowerLaw() + PowerLaw()
model2 = copy(model)
model.K_1.value = 2.0
@test model2.K_2.value == 1.0

@inferred copy(model)
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ end
include("models/test-table-models.jl")
include("models/test-surrogate-models.jl")
include("models/test-auto-cache.jl")
include("models/test-as-convolution.jl")
include("models/test-copy.jl")

# only test XSPEC models when not using CI
# since model data access is annoying
Expand Down

0 comments on commit 509c5ee

Please sign in to comment.