I want to write tests for system that moves entities and detects collisions, system uses Res<Time>
to ensure that entities move with constant speed. I was trying to write test following this example, but it doesn't use Time. My test creates world and inserts two entities and tries to run my system.
let mut world = World::default();
/* here insert entities into world */
let mut update_stage = SystemStage::parallel();
update_stage.add_system(move_system);
It doesn't insert Time resource so unsurprisingly running it ends with
panicked at 'Resource requested by io_project::move_system::move_system does not exist: bevy_core::time::time::Time'
World
has method insert_resource()
but I wasn't able to figure out if I can use it to insert Time
resource.
I was also wondering if it would be possible to use some kind of ''fake'' time, meaning that instead of checking how much time really passed I would call something like time.pass_seconds(1.)
. This would be useful to simulate very high or low framerate and create more consistent results.
I am using bevy 0.6.1