Skip to content

Commit 3fe0027

Browse files
committed
better tests
1 parent 338f990 commit 3fe0027

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tutorial_files = readdir(tutorial_dir)
1313
md_tutorial_files = [split(file, ".")[1] * ".md" for file in tutorial_files]
1414
benchmark_files = [joinpath("benchmarks", e) for e in readdir(benchmarks_dir)]
1515

16-
include_tutorial = false
16+
include_tutorial = true
1717

1818
if include_tutorial
1919
for file in tutorial_files

src/DynamicVehicleScheduling/state.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,11 @@ function decode_bitmatrix_to_routes(routes::BitMatrix)
212212
current = non_depot_next[1]
213213
push!(route, current)
214214
else
215-
# Multiple outgoing edges - this shouldn't happen in valid routes
216-
# but we'll take the first one
217-
current = non_depot_next[1]
218-
push!(route, current)
215+
throw(
216+
ErrorException(
217+
"Invalid route: multiple outgoing edges from location $current"
218+
),
219+
)
219220
end
220221
end
221222

test/dynamic_vsp.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@
4646
y2 = maximizer(θ2; instance=instance2)
4747
@test size(x, 1) == 2
4848
@test size(x2, 1) == 14
49+
50+
anticipative_value, solution = generate_anticipative_solution(b, env; reset_env=true)
51+
reset!(env; reset_rng=true)
52+
cost = sum(step!(env, sample.y_true) for sample in solution)
53+
@test isapprox(cost, anticipative_value; atol=1e-5)
4954
end

0 commit comments

Comments
 (0)