Skip to content

Commit fd4d760

Browse files
committed
Add copy tests to official test suite
- Moved copy tests to test/copy.jl - Added copy tests to runtests.jl to be run with the test suite - Removed temporary test files
1 parent 81c1fab commit fd4d760

File tree

3 files changed

+31
-41
lines changed

3 files changed

+31
-41
lines changed

test_copy.jl renamed to test/copy.jl

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Pkg
2-
Pkg.activate(".")
31
using SciMLOperators
42
using LinearAlgebra
53
using Test
@@ -204,6 +202,31 @@ using Test
204202
# Check that copy is not affected
205203
@test L_copy.L.A[1, 1] != 999.0
206204
end
207-
end
208-
209-
println("All copy tests passed!")
205+
206+
# Test that operators still work correctly after copying
207+
@testset "Functionality after copy" begin
208+
# MatrixOperator
209+
A = rand(5, 5)
210+
L = MatrixOperator(A)
211+
L_copy = copy(L)
212+
v = rand(5)
213+
@test L * v L_copy * v
214+
215+
# ScalarOperator
216+
α = ScalarOperator(2.0)
217+
α_copy = copy(α)
218+
@test α * v α_copy * v
219+
220+
# ComposedOperator
221+
B = MatrixOperator(rand(5, 5))
222+
comp = L B
223+
comp_copy = copy(comp)
224+
@test comp * v comp_copy * v
225+
226+
# AffineOperator
227+
b = rand(5)
228+
aff = AffineOperator(L, B, b)
229+
aff_copy = copy(aff)
230+
@test aff * v aff_copy * v
231+
end
232+
end

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ end
2828
@time @safetestset "Zygote.jl" begin
2929
include("zygote.jl")
3030
end
31+
@time @safetestset "Copy methods" begin
32+
include("copy.jl")
33+
end
3134
elseif GROUP == "All" || GROUP == "Downstream"
3235
activate_downstream_env()
3336
@time @safetestset "AllocCheck" begin

test_simple.jl

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)