public static IEnumerator TestPracticeSelector1() { bool cb = false; //Running Static Analysis 1 new InstanceRequest(() => cb = true, FixedDfc(FixedDifficulty.Lunatic), boss: new BossPracticeRequest(AllPBosses[0], new SMAnalysis.Phase(null !, PhaseType.NONSPELL, 3, new LocalizedString("_")))).Run(); IsFalse(cb); yield return(WaitForLoad()); for (int ii = 0; ii < 10; ++ii) { yield return(null); } var m = BehaviorEntity.GetExecForID("mokou"); AreEqual(0, PublicDataHoisting.GetF("v1", 1)); AreEqual(0, PublicDataHoisting.GetF("v1", 2)); //Go to third phase and then callback AreEqual(7, PublicDataHoisting.GetF("v1", 3)); AreEqual(0, PublicDataHoisting.GetF("v1", 4)); AreEqual(0, m.NumRunningSMs); IsFalse(cb); //2 second delay for (int ii = 0; ii < ETime.ENGINEFPS * InstanceRequest.WaitBeforeReturn; ++ii) { yield return(null); } IsTrue(cb); AreEqual("TestPractice", SceneManager.GetActiveScene().name); }
public static IEnumerator TestStaticAnalysis1_1() { TestHarness.OnSOF(() => { var m = BehaviorEntity.GetExecForID("mokou"); TestHarness.RunBehaviorScript("Static Analysis 1", "mokou"); //Case 1: setup goes to phase 2, which goes to 3 and then 4. TestHarness.Check(2, () => { AreEqual(0, PublicDataHoisting.GetF("v1", 1)); AreEqual(6, PublicDataHoisting.GetF("v1", 2)); AreEqual(7, PublicDataHoisting.GetF("v1", 3)); AreEqual(8, PublicDataHoisting.GetF("v1", 4)); AreEqual(0, m.NumRunningSMs); }); }); while (TestHarness.Running) { yield return(null); } }
public static IEnumerator TestStaticAnalysis1_3() { TestHarness.OnSOF(() => { var m = BehaviorEntity.GetExecForID("mokou"); m.phaseController.Override(3, null, false); TestHarness.RunBehaviorScript("Static Analysis 1", "mokou"); //Case 3: setup is overriden, phase 3 is run; without a callback, goes to phase 4. TestHarness.Check(2, () => { AreEqual(0, PublicDataHoisting.GetF("v1", 1)); AreEqual(0, PublicDataHoisting.GetF("v1", 2)); AreEqual(7, PublicDataHoisting.GetF("v1", 3)); AreEqual(8, PublicDataHoisting.GetF("v1", 4)); AreEqual(0, m.NumRunningSMs); }); }); while (TestHarness.Running) { yield return(null); } }
public static IEnumerator TestStaticAnalysis1_2() { TestHarness.OnSOF(() => { var m = BehaviorEntity.GetExecForID("mokou"); bool cb = false; m.phaseController.Override(3, () => cb = true, false); TestHarness.RunBehaviorScript("Static Analysis 1", "mokou"); //Case 2: setup is overriden, phase 3 is run. TestHarness.Check(0, () => IsTrue(!cb)); TestHarness.Check(2, () => { AreEqual(0, PublicDataHoisting.GetF("v1", 1)); AreEqual(0, PublicDataHoisting.GetF("v1", 2)); AreEqual(7, PublicDataHoisting.GetF("v1", 3)); AreEqual(0, PublicDataHoisting.GetF("v1", 4)); IsTrue(cb); AreEqual(0, m.NumRunningSMs); }); }); while (TestHarness.Running) { yield return(null); } }