ExpectedEvent.Assert C# (CSharp) Method

Assert() public static method

public static Assert ( Evt mask, ExpectedEvent, expected, ArrayList actual ) : bool
mask Evt
expected ExpectedEvent,
actual ArrayList
return bool
    public static bool Assert(Evt mask, ExpectedEvent[] expected, ArrayList actual)
    {
        float lastTime = 0f;

        // TODO: Report meaningful and specific errors.
        int i = 0, j = 0, k = 0, upperBounds = 0;
        upperBounds = Mathf.Max(actual.Count, expected.Length);
        for(i = 0; i < upperBounds; i++) {
        //Debug.Log("i=" + i + ", j=" + j + ", k=" + k + ", expected.Length=" + expected.Length + ", actual.Count=" + actual.Count);
          if(k >= actual.Count) return false;
          EventHistory a = actual[k] as EventHistory;
          if(a == null) throw new System.Exception("Got something other than EventHistory!  Got: " + actual[i]);
          if((a.name & mask) != 0) {
        if(j >= expected.Length) return false;
        if(!expected[j].CheckAgainst(lastTime, a)) return false;
        lastTime = a.realtimeSinceStartup;
        j++;
          }
          k++;
        }

        return true;
    }

Usage Example

Beispiel #1
0
 public void AssertEvents(Evt mask, ExpectedEvent[] expected, ArrayList actual, string msg)
 {
     AssertTrue(ExpectedEvent.Assert(mask, expected, actual), msg);
 }