namespace VRTK.Examples.Tests { using UnityEngine; using System.Collections; public abstract class VRTK_BaseTest : MonoBehaviour { protected string currentTest; protected string currentSetup; protected abstract void Test(); protected virtual void OnEnable() { StartCoroutine(RunTests()); } protected virtual void BeginTest(string name, int level = 1) { currentTest = name; Debug.Log("" + "".PadLeft(level, '#') + " Starting Tests for " + name + ""); } protected virtual void SetUp(string message) { currentSetup = message; Debug.Log("#### Preparing test for " + message + ""); } protected virtual void TearDown() { Debug.Log("=============================================================================="); } protected virtual void Assert(string description, bool assertion, string failure, string success = "") { if (assertion) { Debug.Log("## [" + description + "] PASSED ##"); } else { Debug.Log("## [" + description + "] FAILED INSIDE [" + currentTest + "." + currentSetup + "]##"); } if (!assertion) { Debug.LogException(new System.Exception(failure)); } else if (success != "") { Debug.Log(" ~~~~~> " + success + ""); } } protected virtual IEnumerator RunTests() { yield return new WaitForEndOfFrame(); Test(); } } }