Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: make tests run faster #2277

Closed
wants to merge 7 commits into from
8 changes: 1 addition & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ ForwardDiff = "~0.5.0, ~0.6, ~0.7, ~0.8, ~0.9, ~0.10"
MathOptInterface = "~0.9.11"
MutableArithmetics = "0.2"
NaNMath = "0.3"
OffsetArrays = "≥ 0.2.13"
julia = "1"

[extras]
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["OffsetArrays", "LinearAlgebra", "DualNumbers", "Random", "SparseArrays", "Test"]
test = ["Test"]
20 changes: 11 additions & 9 deletions test/Containers/Containers.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using Test
using JuMP
using JuMP.Containers

@testset "Containers" begin
include("DenseAxisArray.jl")
include("SparseAxisArray.jl")
include("generate_container.jl")
include("vectorized_product_iterator.jl")
include("nested_iterator.jl")
include("no_duplicate_dict.jl")
include("macro.jl")
@testset "$(file)" for file in filter(f -> endswith(f, ".jl"), readdir(@__DIR__))
if file in [
"Containers.jl",
]
continue
end
filename = joinpath(@__DIR__, file)
t = time()
include(filename)
println("$(filename) took $(round(time() - t; digits = 1)) seconds.")
end
end
3 changes: 3 additions & 0 deletions test/Containers/DenseAxisArray.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using JuMP.Containers
using Test

@testset "DenseAxisArray" begin
@testset "undef constructor" begin
A = @inferred DenseAxisArray{Int}(undef, [:a, :b], 1:2)
Expand Down
3 changes: 3 additions & 0 deletions test/Containers/SparseAxisArray.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using JuMP.Containers
using Test

@testset "SparseAxisArray" begin
function sparse_test(d, sum_d, d2, d3, dsqr, d_bads)
sqr(x) = x^2
Expand Down
2 changes: 1 addition & 1 deletion test/Containers/generate_container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using Test
using JuMP
using JuMP.Containers
using Test

macro dummycontainer(expr, requestedtype)
name = gensym()
Expand Down
2 changes: 1 addition & 1 deletion test/Containers/macro.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test
using JuMP
using JuMP.Containers
using Test

@testset "Macro" begin
@testset "Array" begin
Expand Down
3 changes: 3 additions & 0 deletions test/Containers/nested_iterator.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using JuMP.Containers
using Test

@testset "Nested Iterator" begin
iterators = (() -> 1:3, i -> 1:i)
condition(i, j) = j > i
Expand Down
3 changes: 3 additions & 0 deletions test/Containers/no_duplicate_dict.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using JuMP.Containers
using Test

@testset "Iterator with constant eltype" begin
f(ij) = ij => sum(ij)
g = Base.Generator(f, Iterators.product(1:2, 1:2))
Expand Down
3 changes: 3 additions & 0 deletions test/Containers/vectorized_product_iterator.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using JuMP.Containers
using Test

@testset "Vectorized Product Iterator" begin
I = [1 2
3 4]
Expand Down
5 changes: 2 additions & 3 deletions test/JuMPExtension.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
module JuMPExtension

# Simple example of JuMP extension used in the tests to check that JuMP works well with extensions
# The main difference between `JuMP.Model` and `JuMPExtension.MyModel` is the fact that in `add_variable` (resp. `add_constraint`),
# `JuMP.Model` applies the modification to its `moi_backend` field while
# `JuMPExtension.MyModel` stores the `AbstractVariable` (resp. `AbstractConstraint`) in a list.

using MathOptInterface
const MOI = MathOptInterface
import JuMP
using JuMP

struct ConstraintIndex
value::Int # Index in `model.constraints`
Expand Down
Loading