Skip to content

Commit

Permalink
Merge 13b24ed into e1e58a7
Browse files Browse the repository at this point in the history
  • Loading branch information
Tortar authored Sep 24, 2023
2 parents e1e58a7 + 13b24ed commit 4cd4efd
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 20 deletions.
8 changes: 7 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
ignore:
- "examples" # No need to cover the examples
- "src/models" # Examples provide integration testing here
- "src/visualizations" # Plot recipes aren't tested
- "src/deprecations.jl"
- "src/visualizations.jl"
- "ext/AgentsVisualizations"
- "ext/AgentsOSMVisualizations"
- "ext/AgentsGraphVisualizations"
- "benchmark"
- "test"
- "docs"

9 changes: 0 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,3 @@ Scratch = "1"
StaticArrays = "1"
StatsBase = "0.32, 0.33, 0.34"
julia = "1.9"

[extras]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "BenchmarkTools", "StableRNGs", "Arrow"]
4 changes: 2 additions & 2 deletions ext/AgentsVisualizations/src/convenience.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ function init_abm_data_plots!(fig, abmobs, adata, mdata, alabels, mlabels, plotk
# Trigger correct, and efficient, linking of x-axis
linkxaxes!(axs[end], axs[1:end-1]...)
on(stepclick) do clicks
xlims!(axs[1], Makie.MakieLayout.xautolimits(axs[1]))
xlims!(axs[1], Makie.xautolimits(axs[1]))
for ax in axs
ylims!(ax, Makie.MakieLayout.yautolimits(ax))
ylims!(ax, Makie.yautolimits(ax))
end
end
on(resetclick) do clicks
Expand Down
2 changes: 1 addition & 1 deletion ext/AgentsVisualizations/src/interaction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function add_controls!(fig, abmobs, spu)
collect_data!(model[], when, adata, mdata, adf, mdf, abmobs.s[])
end
# Layout buttons
controllayout[2, :] = MakieLayout.hbox!(step, run, reset, clear; tellwidth = false)
controllayout[2, :] = Makie.hbox!(step, run, reset, clear; tellwidth = false)

return step.clicks, reset.clicks
end
Expand Down
4 changes: 2 additions & 2 deletions src/core/model_abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ end
###########################################################################################
"""
model[id]
getindex(model::ABM, id::Integer)
getindex(model::ABM, id::Int)
Return an agent given its ID.
"""
Base.getindex(m::ABM, id::Integer) = agent_container(m)[id]
Base.getindex(m::ABM, id::Int) = agent_container(m)[id]

"""
abmrng(model::ABM)
Expand Down
11 changes: 11 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
OSMMakie = "76b6901f-8821-46bb-9129-841bc9cfe677"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6 changes: 3 additions & 3 deletions test/jld2_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@
end

@testset "OSMSpace" begin
@agent struct Zombie(OSMAgent)
@agent struct Zombiee(OSMAgent)
infected::Bool
end
model = ABM(Zombie, OpenStreetMapSpace(OSM.test_map()); rng = MersenneTwister(42))
model = ABM(Zombiee, OpenStreetMapSpace(OSM.test_map()); rng = MersenneTwister(42))

for id in 1:100
start = random_position(model)
finish = OSM.random_road_position(model)
human = add_agent!(start, Zombie, model, false)
human = add_agent!(start, Zombiee, model, false)
plan_route!(human, finish, model)
end

Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ end
include("api_tests.jl")
include("randomness_tests.jl")
include("scheduler_tests.jl")
include("model_access.jl")
include("space_test.jl")
include("model_access_tests.jl")
include("space_tests.jl")
include("grid_space_tests.jl")
include("collect_tests.jl")
include("continuous_space_tests.jl")
Expand All @@ -161,4 +161,5 @@ end
include("graph_tests.jl")
include("csv_tests.jl")
include("jld2_tests.jl")
include("visualization_tests.jl")
end
File renamed without changes.
9 changes: 9 additions & 0 deletions test/visualization_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# TODO: write actual tests
@testset "agent visualizations" begin
include("../examples/agents_visualizations.jl")
# testing no error when removing files
@test rm("daisyworld.mp4") == nothing
include("../examples/zombies.jl")
@test rm("outbreak.mp4") == nothing
end

0 comments on commit 4cd4efd

Please sign in to comment.