# registry_test.ludic - systems declared with `def Systems ...` from outside the package: the # runner starts from them in the registry's order, and core_add still appends after them import "ludic.base" program RegistryTest { numbers float state RegistryTestState { trail: string = "" } function late_tick(registry_test_st: mut RegistryTestState, t: Tick) -> void { registry_test_st.trail = registry_test_st.trail + "l" } function early_tick(registry_test_st: mut RegistryTestState, t: Tick) -> void { registry_test_st.trail = registry_test_st.trail + "e" } function added_tick(registry_test_st: mut RegistryTestState, t: Tick) -> void { registry_test_st.trail = registry_test_st.trail + "a" } def Systems late { phase: PH_RESOLVE, tick: fn late_tick } def Systems early { phase: PH_INPUT, tick: fn early_tick } test "the declared systems run, phase by phase" (base_st: mut BaseState, registry_test_st: RegistryTestState) { expect_eq(core_count(base_st), 2) expect(Systems[SYS_LATE].key == "late") let s = system_new("added", PH_INPUT) s.tick = fn added_tick core_add(base_st, s) core_tick_all(base_st, tick_new(0.016, 1, 0.0)) expect(registry_test_st.trail == "eal") } }