public void Setup() { QuerySimulationModule.TestMode = true; m_Db = new MARSDatabase(); var dbModule = (IModule)m_Db; dbModule.LoadModule(); m_Pipeline = new StandaloneQueryPipeline(m_Db); m_Pipeline.SetupData(); // creating our own instance of the query backend doesn't work because // we'll get the error about multiple instance of scriptable settings. m_QueryBackend = ModuleLoaderCore.instance.GetModule <MARSQueryBackend>(); m_QueryBackend.Pipeline = m_Pipeline; var queryBackendModule = (IModule)m_QueryBackend; queryBackendModule.LoadModule(); }
public void CheckTimeouts_UtilityFunction() { var indices = new List <int> { 0, 1, 3 }; // the first should be ignored (negative means no timeout) // the second should not time out, as it has more time remaining // the third should be skipped over because it is not in the indices // the fourth one should time out var timeouts = new [] { -1f, 5f, 0f, 0.5f }; const float timeSinceLastCycle = 1f; var timeoutIndices = new HashSet <int>(); StandaloneQueryPipeline.CheckTimeouts(indices, timeouts, timeSinceLastCycle, timeoutIndices); // only the one that has not timed out should have its value modified. // the one that has timed out is about to be removed, so we do not update its value var expectedNewTimeouts = new [] { -1f, 5f - timeSinceLastCycle, 0f, 0.5f }; AssertUtils.DeepEqual(timeouts, expectedNewTimeouts); }