public static void expect(bool didPass, string definition, string failExplaination = null) { float num = printOutLength(definition); int totalWidth = 40 - (int)(num * 1.05f); string text = string.Empty.PadRight(totalWidth, "_"[0]); string text2 = formatB(definition) + " " + text + " [ " + ((!didPass) ? formatC("fail", "red") : formatC("pass", "green")) + " ]"; if (!didPass && failExplaination != null) { text2 = text2 + " - " + failExplaination; } Debug.Log(text2); if (didPass) { passes++; } tests++; if (tests == expected && !testsFinished) { overview(); } else if (tests > expected) { Debug.Log(formatB("Too many tests for a final report!") + " set LeanTest.expected = " + tests); } if (!timeoutStarted) { timeoutStarted = true; GameObject gameObject = new GameObject(); gameObject.name = "~LeanTest"; LeanTester leanTester = gameObject.AddComponent(typeof(LeanTester)) as LeanTester; leanTester.timeout = timeout; gameObject.hideFlags = HideFlags.HideAndDontSave; } }
public static void expect(bool didPass, string definition, string failExplaination = null) { float num = LeanTest.printOutLength(definition); int num2 = 40 - (int)(num * 1.05f); string text = string.Empty.PadRight(num2, "_".get_Chars(0)); string text2 = string.Concat(new string[] { LeanTest.formatB(definition), " ", text, " [ ", (!didPass) ? LeanTest.formatC("fail", "red") : LeanTest.formatC("pass", "green"), " ]" }); if (!didPass && failExplaination != null) { text2 = text2 + " - " + failExplaination; } Debug.Log(text2); if (didPass) { LeanTest.passes++; } LeanTest.tests++; if (LeanTest.tests == LeanTest.expected && !LeanTest.testsFinished) { LeanTest.overview(); } else if (LeanTest.tests > LeanTest.expected) { Debug.Log(LeanTest.formatB("Too many tests for a final report!") + " set LeanTest.expected = " + LeanTest.tests); } if (!LeanTest.timeoutStarted) { LeanTest.timeoutStarted = true; GameObject gameObject = new GameObject(); gameObject.set_name("~LeanTest"); LeanTester leanTester = gameObject.AddComponent(typeof(LeanTester)) as LeanTester; leanTester.timeout = LeanTest.timeout; gameObject.set_hideFlags(61); } }