Skip to content

Commit 8ff0766

Browse files
committed
fixed tests
1 parent 0d8cfd2 commit 8ff0766

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

src/deprecated.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function warnDeprecated(oldStr, newStr, additional="")
88
end
99

1010
function fmi2Simulate(args...; kwargs...)
11-
warnDeprecated("fmi2Simulate", "simulate")
11+
warnDeprecated("fmi2Simulate", "simulate", "FMI version is determined automatically.")
1212
simulate(args...; kwargs...)
1313
end
1414
export fmi2Simulate

src/sim.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function simulate(fmu::FMU3, c::Union{FMU3Instance, Nothing}=nothing, tspan::Uni
7575
error(unknownFMUType)
7676
end
7777
end
78-
simulate(c::FMUInstance, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulate(c.fmu, c, tspan; kwargs...)
79-
simulate(fmu::FMU, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulate(fmu, nothing, tspan; kwargs...)
78+
simulate(c::FMUInstance, tspan::Tuple{Float64, Float64}; kwargs...) = simulate(c.fmu, c, tspan; kwargs...)
79+
simulate(fmu::FMU, tspan::Tuple{Float64, Float64}; kwargs...) = simulate(fmu, nothing, tspan; kwargs...)
8080
export simulate
8181

8282
"""
@@ -125,7 +125,7 @@ State- and Time-Events are handled correctly.
125125
126126
See also [`simulate`](@ref), [`simulateCS`](@ref), [`simulateSE`](@ref).
127127
"""
128-
function simulateME(fmu::FMU, c::Union{FMUInstance, Nothing}, tspan::Tuple{Real, Real};
128+
function simulateME(fmu::FMU, c::Union{FMUInstance, Nothing}, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing;
129129
solver = nothing, # [ToDo] type
130130
recordValues::fmi2ValueReferenceFormat = nothing,
131131
recordEventIndicators::Union{AbstractArray{<:Integer, 1}, UnitRange{<:Integer}, Nothing} = nothing,
@@ -240,8 +240,8 @@ function simulateME(fmu::FMU, c::Union{FMUInstance, Nothing}, tspan::Tuple{Real,
240240

241241
return c.solution
242242
end
243-
simulateME(c::FMUInstance, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulateME(c.fmu, c, tspan; kwargs...)
244-
simulateME(fmu::FMU, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulateME(fmu, nothing, tspan; kwargs...)
243+
simulateME(c::FMUInstance, tspan::Tuple{Float64, Float64}; kwargs...) = simulateME(c.fmu, c, tspan; kwargs...)
244+
simulateME(fmu::FMU, tspan::Tuple{Float64, Float64}; kwargs...) = simulateME(fmu, nothing, tspan; kwargs...)
245245
export simulateME
246246

247247
############ Co-Simulation ############
@@ -438,8 +438,8 @@ function simulateCS(fmu::FMU, c::Union{FMUInstance, Nothing}, tspan::Union{Tuple
438438

439439
return fmusol
440440
end
441-
simulateCS(c::FMUInstance, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulateCS(c.fmu, c, tspan; kwargs...)
442-
simulateCS(fmu::FMU, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulateCS(fmu, nothing, tspan; kwargs...)
441+
simulateCS(c::FMUInstance, tspan::Tuple{Float64, Float64}; kwargs...) = simulateCS(c.fmu, c, tspan; kwargs...)
442+
simulateCS(fmu::FMU, tspan::Tuple{Float64, Float64}; kwargs...) = simulateCS(fmu, nothing, tspan; kwargs...)
443443
export simulateCS
444444

445445
# [TODO] simulate ScheduledExecution
@@ -463,13 +463,13 @@ To be implemented ...
463463
464464
See also [`simulate`](@ref), [`simulateME`](@ref), [`simulateCS`](@ref).
465465
"""
466-
function simulateSE(fmu::FMU2, c::Union{FMU2Component, Nothing})
466+
function simulateSE(fmu::FMU2, c::Union{FMU2Component, Nothing}, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing)
467467
@assert false "This is a FMI2-FMU, scheduled execution is not supported in FMI2."
468468
end
469-
function simulateSE(fmu::FMU3, c::Union{FMU3Instance, Nothing})
469+
function simulateSE(fmu::FMU3, c::Union{FMU3Instance, Nothing}, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing)
470470
# [ToDo]
471471
@assert false "Not implemented yet. Please open an issue if this is needed."
472472
end
473-
simulateSE(c::FMUInstance, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulateSE(c.fmu, c, tspan; kwargs...)
474-
simulateSE(fmu::FMU, tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing; kwargs...) = simulateSE(fmu, nothing, tspan; kwargs...)
473+
simulateSE(c::FMUInstance, tspan::Tuple{Float64, Float64}; kwargs...) = simulateSE(c.fmu, c, tspan; kwargs...)
474+
simulateSE(fmu::FMU, tspan::Tuple{Float64, Float64}; kwargs...) = simulateSE(fmu, nothing, tspan; kwargs...)
475475
export simulateSE

test/runtests.jl

+16-10
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,23 @@ end
9898
end
9999
end
100100
end
101+
102+
@testset "Aqua.jl" begin
103+
@info "Aqua: Method ambiguity"
104+
@testset "Method ambiguities" begin
105+
Aqua.test_ambiguities([FMI])
106+
end
107+
108+
@info "Aqua: Piracies"
109+
@testset "Piracies" begin
110+
Aqua.test_piracies(FMI) # ; broken = true)
111+
end
112+
113+
@info "Aqua: Testing all (method ambiguities and piracies are tested separately)"
114+
Aqua.test_all(FMI; ambiguities = false, piracies = false)
115+
end
116+
101117
elseif Sys.isapple()
102118
@warn "Test-sets are currently using Windows- and Linux-FMUs, automated testing for macOS is currently not supported."
103119
end
104-
@testset "Aqua.jl" begin
105-
# Ambiguities in external packages
106-
@testset "Method ambiguity" begin
107-
Aqua.test_ambiguities([FMI])
108-
end
109-
@testset "Piracy" begin
110-
Aqua.test_piracies(FMI; broken = true)
111-
end
112-
Aqua.test_all(FMI; ambiguities = false, piracies = false)
113-
end
114120
end

0 commit comments

Comments
 (0)