Skip to content

Commit 8765aae

Browse files
Merge pull request #429 from SciML/os/improve-tests
improve tests
2 parents 6957f6f + c0468b6 commit 8765aae

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ LinearAlgebra = "1.10"
5151
Measurements = "2.3"
5252
MonteCarloMeasurements = "1.1"
5353
NLsolve = "4.5"
54-
OrdinaryDiffEq = "6.62"
5554
Pkg = "1"
5655
Random = "1"
5756
RecipesBase = "1.1"
5857
ReverseDiff = "1.15"
5958
SafeTestsets = "0.1"
59+
SciMLBase = "2"
6060
SparseArrays = "1.10"
6161
StaticArrays = "1.6"
6262
StaticArraysCore = "1.4"
@@ -77,10 +77,10 @@ ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
7777
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
7878
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
7979
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
80-
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
8180
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
8281
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
8382
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
83+
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
8484
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
8585
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
8686
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
@@ -90,4 +90,4 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
9090
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
9191

9292
[targets]
93-
test = ["SafeTestsets", "Aqua", "FastBroadcast", "SparseArrays", "ForwardDiff", "NLsolve", "OrdinaryDiffEq", "Pkg", "Test", "Unitful", "Random", "StaticArrays", "StructArrays", "Zygote", "Measurements"]
93+
test = ["Aqua", "FastBroadcast", "ForwardDiff", "Measurements", "NLsolve", "Pkg", "Random", "SafeTestsets", "SciMLBase", "SparseArrays", "StaticArrays", "StructArrays", "Test", "Unitful", "Zygote"]

test/adjoints.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using RecursiveArrayTools, Zygote, ForwardDiff, Test
2-
using OrdinaryDiffEq
2+
using SciMLBase
33

44
function loss(x)
55
sum(abs2, Array(VectorOfArray([x .* i for i in 1:5])))

test/copy_static_array_test.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,33 +87,33 @@ a[1] *= 2
8787
a = [SVector(0.0) for _ in 1:2]
8888
a_voa = VectorOfArray(a)
8989
b_voa = copy(a_voa)
90-
a_voa[1] = SVector(1.0)
91-
a_voa[2] = SVector(1.0)
90+
a_voa[:, 1] = SVector(1.0)
91+
a_voa[:, 2] = SVector(1.0)
9292
@. b_voa = a_voa
93-
@test b_voa[1] == a_voa[1]
94-
@test b_voa[2] == a_voa[2]
93+
@test b_voa[:, 1] == a_voa[1]
94+
@test b_voa[:, 2] == a_voa[2]
9595

9696
a = [SVector(0.0) for _ in 1:2]
9797
a_voa = VectorOfArray(a)
9898
a_voa .= 1.0
99-
@test a_voa[1] == SVector(1.0)
100-
@test a_voa[2] == SVector(1.0)
99+
@test a_voa[:, 1] == SVector(1.0)
100+
@test a_voa[:, 2] == SVector(1.0)
101101

102102
# Broadcasting when SVector{N} where N > 1
103103
a = [SVector(0.0, 0.0) for _ in 1:2]
104104
a_voa = VectorOfArray(a)
105105
b_voa = copy(a_voa)
106-
a_voa[1] = SVector(1.0, 1.0)
107-
a_voa[2] = SVector(1.0, 1.0)
106+
a_voa[:, 1] = SVector(1.0, 1.0)
107+
a_voa[:, 2] = SVector(1.0, 1.0)
108108
@. b_voa = a_voa
109-
@test b_voa[1] == a_voa[1]
110-
@test b_voa[2] == a_voa[2]
109+
@test b_voa[:, 1] == a_voa[:, 1]
110+
@test b_voa[:, 2] == a_voa[:, 2]
111111

112112
a = [SVector(0.0, 0.0) for _ in 1:2]
113113
a_voa = VectorOfArray(a)
114114
a_voa .= 1.0
115-
@test a_voa[1] == SVector(1.0, 1.0)
116-
@test a_voa[2] == SVector(1.0, 1.0)
115+
@test a_voa[:, 1] == SVector(1.0, 1.0)
116+
@test a_voa[:, 2] == SVector(1.0, 1.0)
117117

118118
#Broadcast Copy of StructArray
119119
x = StructArray{SVector{2, Float64}}((randn(2), randn(2)))
@@ -122,12 +122,12 @@ vx2 = copy(vx) .+ 1
122122
ans = vx .+ vx2
123123
@test ans.u isa StructArray
124124

125-
# check that Base.similar(VectorOfArray{<:StaticArray}) returns the
125+
# check that Base.similar(VectorOfArray{<:StaticArray}) returns the
126126
# same type as the original VectorOfArray
127127
x_staticvector = [SVector(0.0, 0.0) for _ in 1:2]
128128
x_structarray = StructArray{SVector{2, Float64}}((randn(2), randn(2)))
129129
x_mutablefv = [MutableFV(1.0, 2.0)]
130130
x_immutablefv = [ImmutableFV(1.0, 2.0)]
131131
for vec in [x_staticvector, x_structarray, x_mutablefv, x_immutablefv]
132132
@test typeof(similar(VectorOfArray(vec))) === typeof(VectorOfArray(vec))
133-
end
133+
end

test/qa.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
using RecursiveArrayTools, Aqua
1+
using RecursiveArrayTools, Aqua, Pkg
2+
3+
# yes this is horrible, we'll fix it when Pkg or Base provides a decent API
4+
manifest = Pkg.Types.EnvCache().manifest
5+
# these are good sentinels to test whether someone has added a heavy SciML package to the test deps
6+
if haskey(manifest.deps, "NonlinearSolveBase") || haskey(manifest.deps, "DiffEqBase")
7+
error("Don't put Downstream Packages in non Downstream CI")
8+
end
9+
210
@testset "Aqua" begin
311
Aqua.find_persistent_tasks_deps(RecursiveArrayTools)
412
Aqua.test_ambiguities(RecursiveArrayTools; recursive = false, broken = true)

0 commit comments

Comments
 (0)