Accelerate tests with Revise.jl

feature/stochastic
Alinson S. Xavier 3 years ago
parent dde0d40282
commit 4b0fc7327c
Signed by: isoron
GPG Key ID: 0DA8E4B9E1109DCA

@ -21,6 +21,7 @@ OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d" PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568" ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4" Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StochasticPrograms = "8b8459f2-c380-502b-8633-9aed2d6c2b35" StochasticPrograms = "8b8459f2-c380-502b-8633-9aed2d6c2b35"

@ -1,11 +0,0 @@
[ Info: Reading s1.json...
[ Info: Building graph...
[ Info: 2 time periods
[ Info: 6 process nodes
[ Info: 8 shipping nodes (plant)
[ Info: 10 shipping nodes (collection)
[ Info: 38 arcs
[ Info: Building optimization model...
[ Info: Optimizing MILP...
[ Info: Re-optimizing with integer variables fixed...
[ Info: Extracting solution...

@ -3,37 +3,38 @@
using RELOG using RELOG
@testset "build_graph" begin function graph_build_test()
basedir = dirname(@__FILE__) @testset "build_graph" begin
instance = RELOG.parsefile("$basedir/../../instances/s1.json") instance = RELOG.parsefile(fixture("instances/s1.json"))
graph = RELOG.build_graph(instance) graph = RELOG.build_graph(instance)
process_node_by_location_name = process_node_by_location_name =
Dict(n.location.location_name => n for n in graph.process_nodes) Dict(n.location.location_name => n for n in graph.process_nodes)
@test length(graph.plant_shipping_nodes) == 8 @test length(graph.plant_shipping_nodes) == 8
@test length(graph.collection_shipping_nodes) == 10 @test length(graph.collection_shipping_nodes) == 10
@test length(graph.process_nodes) == 6 @test length(graph.process_nodes) == 6
node = graph.collection_shipping_nodes[1] node = graph.collection_shipping_nodes[1]
@test node.location.name == "C1" @test node.location.name == "C1"
@test length(node.incoming_arcs) == 0 @test length(node.incoming_arcs) == 0
@test length(node.outgoing_arcs) == 2 @test length(node.outgoing_arcs) == 2
@test node.outgoing_arcs[1].source.location.name == "C1" @test node.outgoing_arcs[1].source.location.name == "C1"
@test node.outgoing_arcs[1].dest.location.plant_name == "F1" @test node.outgoing_arcs[1].dest.location.plant_name == "F1"
@test node.outgoing_arcs[1].dest.location.location_name == "L1" @test node.outgoing_arcs[1].dest.location.location_name == "L1"
@test node.outgoing_arcs[1].values["distance"] == 1095.62 @test node.outgoing_arcs[1].values["distance"] == 1095.62
node = process_node_by_location_name["L1"] node = process_node_by_location_name["L1"]
@test node.location.plant_name == "F1" @test node.location.plant_name == "F1"
@test node.location.location_name == "L1" @test node.location.location_name == "L1"
@test length(node.incoming_arcs) == 10 @test length(node.incoming_arcs) == 10
@test length(node.outgoing_arcs) == 2 @test length(node.outgoing_arcs) == 2
node = process_node_by_location_name["L3"] node = process_node_by_location_name["L3"]
@test node.location.plant_name == "F2" @test node.location.plant_name == "F2"
@test node.location.location_name == "L3" @test node.location.location_name == "L3"
@test length(node.incoming_arcs) == 2 @test length(node.incoming_arcs) == 2
@test length(node.outgoing_arcs) == 2 @test length(node.outgoing_arcs) == 2
@test length(graph.arcs) == 38 @test length(graph.arcs) == 38
end end
end

@ -3,51 +3,52 @@
using RELOG using RELOG
@testset "compress" begin function compress_test()
basedir = dirname(@__FILE__) @testset "compress" begin
instance = RELOG.parsefile("$basedir/../../instances/s1.json") instance = RELOG.parsefile(fixture("instances/s1.json"))
compressed = RELOG._compress(instance) compressed = RELOG._compress(instance)
product_name_to_product = Dict(p.name => p for p in compressed.products) product_name_to_product = Dict(p.name => p for p in compressed.products)
location_name_to_facility = Dict() location_name_to_facility = Dict()
for p in compressed.plants for p in compressed.plants
location_name_to_facility[p.location_name] = p location_name_to_facility[p.location_name] = p
end
for c in compressed.collection_centers
location_name_to_facility[c.name] = c
end
p1 = product_name_to_product["P1"]
p2 = product_name_to_product["P2"]
p3 = product_name_to_product["P3"]
c1 = location_name_to_facility["C1"]
l1 = location_name_to_facility["L1"]
@test compressed.time == 1
@test compressed.building_period == [1]
@test p1.name == "P1"
@test p1.transportation_cost [0.015]
@test p1.transportation_energy [0.115]
@test p1.transportation_emissions["CO2"] [0.051]
@test p1.transportation_emissions["CH4"] [0.0025]
@test c1.name == "C1"
@test c1.amount [1869.12]
@test l1.plant_name == "F1"
@test l1.location_name == "L1"
@test l1.energy [0.115]
@test l1.emissions["CO2"] [0.051]
@test l1.emissions["CH4"] [0.0025]
@test l1.sizes[1].opening_cost [500]
@test l1.sizes[2].opening_cost [1250]
@test l1.sizes[1].fixed_operating_cost [60]
@test l1.sizes[2].fixed_operating_cost [60]
@test l1.sizes[1].variable_operating_cost [30]
@test l1.sizes[2].variable_operating_cost [30]
@test l1.disposal_limit[p2] [2.0]
@test l1.disposal_limit[p3] [2.0]
@test l1.disposal_cost[p2] [-10.0]
@test l1.disposal_cost[p3] [-10.0]
end end
for c in compressed.collection_centers end
location_name_to_facility[c.name] = c
end
p1 = product_name_to_product["P1"]
p2 = product_name_to_product["P2"]
p3 = product_name_to_product["P3"]
c1 = location_name_to_facility["C1"]
l1 = location_name_to_facility["L1"]
@test compressed.time == 1
@test compressed.building_period == [1]
@test p1.name == "P1"
@test p1.transportation_cost [0.015]
@test p1.transportation_energy [0.115]
@test p1.transportation_emissions["CO2"] [0.051]
@test p1.transportation_emissions["CH4"] [0.0025]
@test c1.name == "C1"
@test c1.amount [1869.12]
@test l1.plant_name == "F1"
@test l1.location_name == "L1"
@test l1.energy [0.115]
@test l1.emissions["CO2"] [0.051]
@test l1.emissions["CH4"] [0.0025]
@test l1.sizes[1].opening_cost [500]
@test l1.sizes[2].opening_cost [1250]
@test l1.sizes[1].fixed_operating_cost [60]
@test l1.sizes[2].fixed_operating_cost [60]
@test l1.sizes[1].variable_operating_cost [30]
@test l1.sizes[2].variable_operating_cost [30]
@test l1.disposal_limit[p2] [2.0]
@test l1.disposal_limit[p3] [2.0]
@test l1.disposal_cost[p2] [-10.0]
@test l1.disposal_cost[p3] [-10.0]
end

@ -4,22 +4,24 @@
using RELOG using RELOG
@testset "geodb_query (2018-us-county)" begin function geodb_test()
region = RELOG.geodb_query("2018-us-county:17043") @testset "geodb_query (2018-us-county)" begin
@test region.centroid.lat == 41.83956 region = RELOG.geodb_query("2018-us-county:17043")
@test region.centroid.lon == -88.08857 @test region.centroid.lat == 41.83956
@test region.population == 922_921 @test region.centroid.lon == -88.08857
end @test region.population == 922_921
end
# @testset "geodb_query (2018-us-zcta)" begin # @testset "geodb_query (2018-us-zcta)" begin
# region = RELOG.geodb_query("2018-us-zcta:60439") # region = RELOG.geodb_query("2018-us-zcta:60439")
# @test region.centroid.lat == 41.68241 # @test region.centroid.lat == 41.68241
# @test region.centroid.lon == -87.98954 # @test region.centroid.lon == -87.98954
# end # end
@testset "geodb_query (us-state)" begin @testset "geodb_query (us-state)" begin
region = RELOG.geodb_query("us-state:IL") region = RELOG.geodb_query("us-state:IL")
@test region.centroid.lat == 39.73939 @test region.centroid.lat == 39.73939
@test region.centroid.lon == -89.50414 @test region.centroid.lon == -89.50414
@test region.population == 12_671_821 @test region.population == 12_671_821
end end
end

@ -3,91 +3,90 @@
using RELOG using RELOG
@testset "parse" begin function parse_test()
basedir = dirname(@__FILE__) @testset "parse" begin
instance = RELOG.parsefile("$basedir/../../instances/s1.json") instance = RELOG.parsefile(fixture("instances/s1.json"))
centers = instance.collection_centers centers = instance.collection_centers
plants = instance.plants plants = instance.plants
products = instance.products products = instance.products
location_name_to_plant = Dict(p.location_name => p for p in plants) location_name_to_plant = Dict(p.location_name => p for p in plants)
product_name_to_product = Dict(p.name => p for p in products) product_name_to_product = Dict(p.name => p for p in products)
@test length(centers) == 10 @test length(centers) == 10
@test centers[1].name == "C1" @test centers[1].name == "C1"
@test centers[1].latitude == 7 @test centers[1].latitude == 7
@test centers[1].latitude == 7 @test centers[1].latitude == 7
@test centers[1].longitude == 7 @test centers[1].longitude == 7
@test centers[1].amount == [934.56, 934.56] @test centers[1].amount == [934.56, 934.56]
@test centers[1].product.name == "P1" @test centers[1].product.name == "P1"
@test length(plants) == 6 @test length(plants) == 6
plant = location_name_to_plant["L1"] plant = location_name_to_plant["L1"]
@test plant.plant_name == "F1" @test plant.plant_name == "F1"
@test plant.location_name == "L1" @test plant.location_name == "L1"
@test plant.input.name == "P1" @test plant.input.name == "P1"
@test plant.latitude == 0 @test plant.latitude == 0
@test plant.longitude == 0 @test plant.longitude == 0
@test length(plant.sizes) == 2 @test length(plant.sizes) == 2
@test plant.sizes[1].capacity == 250 @test plant.sizes[1].capacity == 250
@test plant.sizes[1].opening_cost == [500, 500] @test plant.sizes[1].opening_cost == [500, 500]
@test plant.sizes[1].fixed_operating_cost == [30, 30] @test plant.sizes[1].fixed_operating_cost == [30, 30]
@test plant.sizes[1].variable_operating_cost == [30, 30] @test plant.sizes[1].variable_operating_cost == [30, 30]
@test plant.sizes[2].capacity == 1000 @test plant.sizes[2].capacity == 1000
@test plant.sizes[2].opening_cost == [1250, 1250] @test plant.sizes[2].opening_cost == [1250, 1250]
@test plant.sizes[2].fixed_operating_cost == [30, 30] @test plant.sizes[2].fixed_operating_cost == [30, 30]
@test plant.sizes[2].variable_operating_cost == [30, 30] @test plant.sizes[2].variable_operating_cost == [30, 30]
p1 = product_name_to_product["P1"] p1 = product_name_to_product["P1"]
@test p1.disposal_limit == [1.0, 1.0] @test p1.disposal_limit == [1.0, 1.0]
@test p1.disposal_cost == [-1000.0, -1000.0] @test p1.disposal_cost == [-1000.0, -1000.0]
p2 = product_name_to_product["P2"] p2 = product_name_to_product["P2"]
@test p2.disposal_limit == [0.0, 0.0] @test p2.disposal_limit == [0.0, 0.0]
@test p2.disposal_cost == [0.0, 0.0] @test p2.disposal_cost == [0.0, 0.0]
p3 = product_name_to_product["P3"] p3 = product_name_to_product["P3"]
@test length(plant.output) == 2 @test length(plant.output) == 2
@test plant.output[p2] == 0.2 @test plant.output[p2] == 0.2
@test plant.output[p3] == 0.5 @test plant.output[p3] == 0.5
@test plant.disposal_limit[p2] == [1, 1] @test plant.disposal_limit[p2] == [1, 1]
@test plant.disposal_limit[p3] == [1, 1] @test plant.disposal_limit[p3] == [1, 1]
@test plant.disposal_cost[p2] == [-10, -10] @test plant.disposal_cost[p2] == [-10, -10]
@test plant.disposal_cost[p3] == [-10, -10] @test plant.disposal_cost[p3] == [-10, -10]
plant = location_name_to_plant["L3"] plant = location_name_to_plant["L3"]
@test plant.location_name == "L3" @test plant.location_name == "L3"
@test plant.input.name == "P2" @test plant.input.name == "P2"
@test plant.latitude == 25 @test plant.latitude == 25
@test plant.longitude == 65 @test plant.longitude == 65
@test length(plant.sizes) == 2 @test length(plant.sizes) == 2
@test plant.sizes[1].capacity == 1000.0 @test plant.sizes[1].capacity == 1000.0
@test plant.sizes[1].opening_cost == [3000, 3000] @test plant.sizes[1].opening_cost == [3000, 3000]
@test plant.sizes[1].fixed_operating_cost == [50, 50] @test plant.sizes[1].fixed_operating_cost == [50, 50]
@test plant.sizes[1].variable_operating_cost == [50, 50] @test plant.sizes[1].variable_operating_cost == [50, 50]
@test plant.sizes[1] == plant.sizes[2] @test plant.sizes[1] == plant.sizes[2]
p4 = product_name_to_product["P4"] p4 = product_name_to_product["P4"]
@test plant.output[p3] == 0.05 @test plant.output[p3] == 0.05
@test plant.output[p4] == 0.8 @test plant.output[p4] == 0.8
@test plant.disposal_limit[p3] == [1e8, 1e8] @test plant.disposal_limit[p3] == [1e8, 1e8]
@test plant.disposal_limit[p4] == [0, 0] @test plant.disposal_limit[p4] == [0, 0]
end end
@testset "parse (geodb)" begin @testset "parse (geodb)" begin
basedir = dirname(@__FILE__) instance = RELOG.parsefile(fixture("instances/s2.json"))
instance = RELOG.parsefile("$basedir/../../instances/s2.json")
centers = instance.collection_centers
centers = instance.collection_centers @test centers[1].name == "C1"
@test centers[1].name == "C1" @test centers[1].latitude == 41.83956
@test centers[1].latitude == 41.83956 @test centers[1].longitude == -88.08857
@test centers[1].longitude == -88.08857 end
end
# @testset "parse (invalid)" begin
# @testset "parse (invalid)" begin # @test_throws ErrorException RELOG.parsefile(fixture("s1-wrong-length.json"))
# basedir = dirname(@__FILE__) # end
# @test_throws ErrorException RELOG.parsefile("$basedir/../fixtures/s1-wrong-length.json") end
# end

@ -3,35 +3,36 @@
using RELOG, HiGHS, JuMP, Printf, JSON, MathOptInterface.FileFormats using RELOG, HiGHS, JuMP, Printf, JSON, MathOptInterface.FileFormats
@testset "build" begin function model_build_test()
basedir = dirname(@__FILE__) @testset "build" begin
instance = RELOG.parsefile("$basedir/../../instances/s1.json") instance = RELOG.parsefile(fixture("instances/s1.json"))
graph = RELOG.build_graph(instance) graph = RELOG.build_graph(instance)
model = RELOG.build_model(instance, graph, HiGHS.Optimizer) model = RELOG.build_model(instance, graph, HiGHS.Optimizer)
process_node_by_location_name = process_node_by_location_name =
Dict(n.location.location_name => n for n in graph.process_nodes) Dict(n.location.location_name => n for n in graph.process_nodes)
shipping_node_by_loc_and_prod_names = Dict( shipping_node_by_loc_and_prod_names = Dict(
(n.location.location_name, n.product.name) => n for n in graph.plant_shipping_nodes (n.location.location_name, n.product.name) => n for n in graph.plant_shipping_nodes
) )
@test length(model[1, :open_plant]) == 12 @test length(model[1, :open_plant]) == 12
@test length(model[2, :flow]) == 76 @test length(model[2, :flow]) == 76
@test length(model[2, :plant_dispose]) == 16 @test length(model[2, :plant_dispose]) == 16
@test length(model[2, :capacity]) == 12 @test length(model[2, :capacity]) == 12
@test length(model[2, :expansion]) == 12 @test length(model[2, :expansion]) == 12
# l1 = process_node_by_location_name["L1"] # l1 = process_node_by_location_name["L1"]
# v = model[2, :capacity][l1.index, 1] # v = model[2, :capacity][l1.index, 1]
# @test lower_bound(v) == 0.0 # @test lower_bound(v) == 0.0
# @test upper_bound(v) == 1000.0 # @test upper_bound(v) == 1000.0
# v = model[2, :expansion][l1.index, 1] # v = model[2, :expansion][l1.index, 1]
# @test lower_bound(v) == 0.0 # @test lower_bound(v) == 0.0
# @test upper_bound(v) == 750.0 # @test upper_bound(v) == 750.0
# v = model[2, :plant_dispose][shipping_node_by_loc_and_prod_names["L1", "P2"].index, 1] # v = model[2, :plant_dispose][shipping_node_by_loc_and_prod_names["L1", "P2"].index, 1]
# @test lower_bound(v) == 0.0 # @test lower_bound(v) == 0.0
# @test upper_bound(v) == 1.0 # @test upper_bound(v) == 1.0
end end
end

@ -5,63 +5,65 @@ using RELOG, JuMP, Printf, JSON, MathOptInterface.FileFormats
basedir = dirname(@__FILE__) basedir = dirname(@__FILE__)
@testset "solve (exact)" begin function model_solve_test()
solution = RELOG.solve("$basedir/../../instances/s1.json") @testset "solve (exact)" begin
solution = RELOG.solve(fixture("instances/s1.json"))
solution_filename = tempname() solution_filename = tempname()
RELOG.write(solution, solution_filename) RELOG.write(solution, solution_filename)
@test isfile(solution_filename) @test isfile(solution_filename)
@test "Costs" in keys(solution) @test "Costs" in keys(solution)
@test "Fixed operating (\$)" in keys(solution["Costs"]) @test "Fixed operating (\$)" in keys(solution["Costs"])
@test "Transportation (\$)" in keys(solution["Costs"]) @test "Transportation (\$)" in keys(solution["Costs"])
@test "Variable operating (\$)" in keys(solution["Costs"]) @test "Variable operating (\$)" in keys(solution["Costs"])
@test "Total (\$)" in keys(solution["Costs"]) @test "Total (\$)" in keys(solution["Costs"])
@test "Plants" in keys(solution) @test "Plants" in keys(solution)
@test "F1" in keys(solution["Plants"]) @test "F1" in keys(solution["Plants"])
@test "F2" in keys(solution["Plants"]) @test "F2" in keys(solution["Plants"])
@test "F3" in keys(solution["Plants"]) @test "F3" in keys(solution["Plants"])
@test "F4" in keys(solution["Plants"]) @test "F4" in keys(solution["Plants"])
@test "Products" in keys(solution) @test "Products" in keys(solution)
@test "P1" in keys(solution["Products"]) @test "P1" in keys(solution["Products"])
@test "C1" in keys(solution["Products"]["P1"]) @test "C1" in keys(solution["Products"]["P1"])
@test "Dispose (tonne)" in keys(solution["Products"]["P1"]["C1"]) @test "Dispose (tonne)" in keys(solution["Products"]["P1"]["C1"])
total_disposal = total_disposal =
sum([loc["Dispose (tonne)"] for loc in values(solution["Products"]["P1"])]) sum([loc["Dispose (tonne)"] for loc in values(solution["Products"]["P1"])])
@test total_disposal == [1.0, 1.0] @test total_disposal == [1.0, 1.0]
end end
@testset "solve (heuristic)" begin @testset "solve (heuristic)" begin
# Should not crash # Should not crash
solution = RELOG.solve("$basedir/../../instances/s1.json", heuristic = true) solution = RELOG.solve(fixture("instances/s1.json"), heuristic = true)
end end
@testset "solve (infeasible)" begin @testset "solve (infeasible)" begin
json = JSON.parsefile("$basedir/../../instances/s1.json") json = JSON.parsefile(fixture("instances/s1.json"))
for (location_name, location_dict) in json["products"]["P1"]["initial amounts"] for (location_name, location_dict) in json["products"]["P1"]["initial amounts"]
location_dict["amount (tonne)"] *= 1000 location_dict["amount (tonne)"] *= 1000
end
@test_throws ErrorException("No solution available") RELOG.solve(RELOG.parse(json))
end end
@test_throws ErrorException("No solution available") RELOG.solve(RELOG.parse(json))
end
@testset "solve (with storage)" begin @testset "solve (with storage)" begin
basedir = dirname(@__FILE__) basedir = dirname(@__FILE__)
filename = "$basedir/../fixtures/storage.json" filename = "$basedir/../fixtures/storage.json"
instance = RELOG.parsefile(filename) instance = RELOG.parsefile(filename)
@test instance.plants[1].storage_limit == 50.0 @test instance.plants[1].storage_limit == 50.0
@test instance.plants[1].storage_cost == [2.0, 1.5, 1.0] @test instance.plants[1].storage_cost == [2.0, 1.5, 1.0]
solution = RELOG.solve(filename) solution = RELOG.solve(filename)
plant_dict = solution["Plants"]["mega plant"]["Chicago"] plant_dict = solution["Plants"]["mega plant"]["Chicago"]
@test plant_dict["Variable operating cost (\$)"] == [500.0, 0.0, 100.0] @test plant_dict["Variable operating cost (\$)"] == [500.0, 0.0, 100.0]
@test plant_dict["Process (tonne)"] == [50.0, 0.0, 50.0] @test plant_dict["Process (tonne)"] == [50.0, 0.0, 50.0]
@test plant_dict["Storage (tonne)"] == [50.0, 50.0, 0.0] @test plant_dict["Storage (tonne)"] == [50.0, 50.0, 0.0]
@test plant_dict["Storage cost (\$)"] == [100.0, 75.0, 0.0] @test plant_dict["Storage cost (\$)"] == [100.0, 75.0, 0.0]
@test solution["Costs"]["Variable operating (\$)"] == [500.0, 0.0, 100.0] @test solution["Costs"]["Variable operating (\$)"] == [500.0, 0.0, 100.0]
@test solution["Costs"]["Storage (\$)"] == [100.0, 75.0, 0.0] @test solution["Costs"]["Storage (\$)"] == [100.0, 75.0, 0.0]
@test solution["Costs"]["Total (\$)"] == [600.0, 75.0, 100.0] @test solution["Costs"]["Total (\$)"] == [600.0, 75.0, 100.0]
end end
end

@ -6,16 +6,18 @@ using RELOG, JSON, GZip
basedir = @__DIR__ basedir = @__DIR__
@testset "Reports" begin function reports_test()
@testset "from solve" begin @testset "Reports" begin
solution = RELOG.solve("$basedir/../instances/s1.json") @testset "from solve" begin
tmp_filename = tempname() solution = RELOG.solve(fixture("instances/s1.json"))
# The following should not crash tmp_filename = tempname()
RELOG.write_plant_emissions_report(solution, tmp_filename) # The following should not crash
RELOG.write_plant_outputs_report(solution, tmp_filename) RELOG.write_plant_emissions_report(solution, tmp_filename)
RELOG.write_plants_report(solution, tmp_filename) RELOG.write_plant_outputs_report(solution, tmp_filename)
RELOG.write_products_report(solution, tmp_filename) RELOG.write_plants_report(solution, tmp_filename)
RELOG.write_transportation_emissions_report(solution, tmp_filename) RELOG.write_products_report(solution, tmp_filename)
RELOG.write_transportation_report(solution, tmp_filename) RELOG.write_transportation_emissions_report(solution, tmp_filename)
RELOG.write_transportation_report(solution, tmp_filename)
end
end end
end end

@ -2,19 +2,46 @@
# Written by Alinson Santos Xavier <axavier@anl.gov> # Written by Alinson Santos Xavier <axavier@anl.gov>
using Test using Test
using RELOG
using Revise
@testset "RELOG" begin includet("instance/compress_test.jl")
@testset "Instance" begin includet("instance/geodb_test.jl")
include("instance/compress_test.jl") includet("instance/parse_test.jl")
include("instance/geodb_test.jl") includet("graph/build_test.jl")
include("instance/parse_test.jl") includet("model/build_test.jl")
end includet("model/solve_test.jl")
@testset "Graph" begin includet("reports_test.jl")
include("graph/build_test.jl")
function fixture(path)
for candidate in [
"fixtures/$path",
"test/fixtures/$path"
]
if isfile(candidate)
return candidate
end
end end
@testset "Model" begin error("Fixture not found: $path")
include("model/build_test.jl") end
include("model/solve_test.jl")
function runtests()
@testset "RELOG" begin
@testset "Instance" begin
compress_test()
geodb_test()
parse_test()
end
@testset "Graph" begin
graph_build_test()
end
@testset "Model" begin
model_build_test()
model_solve_test()
end
reports_test()
end end
include("reports_test.jl") return
end end
runtests()

Loading…
Cancel
Save