Fix crash when generating transportation reports

This commit is contained in:
2020-10-09 09:33:05 -05:00
parent 77cd5871a2
commit be5e09a4ec
2 changed files with 21 additions and 9 deletions

View File

@@ -20,9 +20,21 @@ function check(func, expected_csv_filename::String)
end
@testset "Reports" begin
check(RELOG.write_plants_report, "fixtures/nimh_plants.csv")
check(RELOG.write_plant_outputs_report, "fixtures/nimh_plant_outputs.csv")
check(RELOG.write_plant_emissions_report, "fixtures/nimh_plant_emissions.csv")
check(RELOG.write_transportation_report, "fixtures/nimh_transportation.csv")
check(RELOG.write_transportation_emissions_report, "fixtures/nimh_transportation_emissions.csv")
@testset "from fixture" begin
check(RELOG.write_plants_report, "fixtures/nimh_plants.csv")
check(RELOG.write_plant_outputs_report, "fixtures/nimh_plant_outputs.csv")
check(RELOG.write_plant_emissions_report, "fixtures/nimh_plant_emissions.csv")
check(RELOG.write_transportation_report, "fixtures/nimh_transportation.csv")
check(RELOG.write_transportation_emissions_report, "fixtures/nimh_transportation_emissions.csv")
end
@testset "from solve" begin
solution = RELOG.solve("$(pwd())/../instances/s1.json")
tmp_filename = tempname()
# The following should not crash
RELOG.write_plants_report(solution, tmp_filename)
RELOG.write_plant_outputs_report(solution, tmp_filename)
RELOG.write_plant_emissions_report(solution, tmp_filename)
RELOG.write_transportation_report(solution, tmp_filename)
RELOG.write_transportation_emissions_report(solution, tmp_filename)
end
end