Skip to content

Commit 73baf61

Browse files
tweaked tests to also have multi-segment links
1 parent 041511c commit 73baf61

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/test_engines.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ def get_net(sym_type: Literal["MX", "SX"], link_with_ramp: int = 2):
3939
N1 = Node(name="N1")
4040
N2 = Node(name="N2")
4141
N3 = Node(name="N3")
42-
N4 = Node(name="N3")
43-
L1 = Link(1, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L1")
44-
L2 = Link(1, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L2")
45-
L3 = Link(1, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L3")
4642
O1 = MeteredOnRamp(C[0], name="O1")
4743
O2 = SimplifiedMeteredOnRamp(C[1], name="O2")
4844
D1 = CongestedDestination(name="D1")
45+
if link_with_ramp == 1:
46+
L1 = Link(1, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L1")
47+
L2 = Link(2, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L2")
48+
else:
49+
L1 = Link(2, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L1")
50+
L2 = Link(1, lanes, L, rho_max, rho_crit_sym, v_free_sym, a_sym, name="L2")
4951
net = (
5052
Network(name="A1")
51-
.add_path(origin=O1, path=(N1, L1, N2, L2, N3, L3, N4), destination=D1)
52-
.add_origin(O2, N2 if link_with_ramp == 1 else N3)
53+
.add_path(origin=O1, path=(N1, L1, N2, L2, N3), destination=D1)
54+
.add_origin(O2, N2)
5355
)
5456
sym_pars = {"rho_crit": rho_crit_sym, "a": a_sym, "v_free": v_free_sym}
5557
others = {
@@ -67,7 +69,7 @@ def get_net(sym_type: Literal["MX", "SX"], link_with_ramp: int = 2):
6769

6870

6971
def get_hardcoded_dynamics(
70-
L, lanes, C, tau, kappa, eta, rho_max, delta, T, link_with_ramp: int = 2, **kwargs
72+
L, lanes, C, tau, kappa, eta, rho_max, delta, T, link_with_ramp: int = 2, **_
7173
) -> cs.Function:
7274
# sourcery skip: use-contextlib-suppress
7375
assert link_with_ramp in {1, 2}

0 commit comments

Comments
 (0)