diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index 4059f119..eff64df9 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -3,10 +3,10 @@ using TulipaEnergyModel const SUITE = BenchmarkGroup() -SUITE["io"] = BenchmarkGroup(["data", "input", "graph", "output"]) -SUITE["model"] = BenchmarkGroup(["model"]) +SUITE["io"] = BenchmarkGroup() +SUITE["model"] = BenchmarkGroup() -const INPUT_FOLDER = joinpath(@__DIR__, "..", "test", "inputs", "tiny") +const INPUT_FOLDER = joinpath(@__DIR__, "..", "test", "inputs", "Norse") const OUTPUT_FOLDER = joinpath(@__DIR__, "..", "test", "outputs") SUITE["io"]["input"] = @benchmarkable begin @@ -25,18 +25,23 @@ graph = create_graph( joinpath(INPUT_FOLDER, "flows-data.csv"), ) -SUITE["model"]["all"] = @benchmarkable begin +SUITE["model"]["create_model"] = @benchmarkable begin create_model($graph, $parameters, $sets) end model = create_model(graph, parameters, sets) + +SUITE["model"]["solve_model"] = @benchmarkable begin + solve_model($model) +end + solution = solve_model(model) SUITE["io"]["output"] = @benchmarkable begin save_solution_to_file( $OUTPUT_FOLDER, $(sets.assets_investment), - $(solution.v_investment), - $(parameters.unit_capacity), + $(solution.assets_investment), + $(parameters.assets_unit_capacity), ) end diff --git a/test/Project.toml b/test/Project.toml index 583a6147..06269817 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" diff --git a/test/runtests.jl b/test/runtests.jl index 3133f8ce..3dc17009 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -117,3 +117,8 @@ end @test compute_rp_periods([time_steps4, time_steps5]) == [1:6, 7:12] end end + +@testset "Ensuring benchmark loads" begin + include(joinpath(@__DIR__, "..", "benchmark", "benchmarks.jl")) + @test SUITE !== nothing +end