Ejemplo n.º 1
0
 [Test] public void RestartCases(
     [Values(S.Failed)] S s,
     [Values(true, false)] bool warnOnFail,
     [Values(true, false)] bool warnOnOverflow)
 {
     x.warnOnFail     = warnOnFail;
     x.warnOnOverflow = warnOnOverflow;
     o(x.Block(s), false);
     //o( x.OnResult(s), Handlers.Restart );
 }
Ejemplo n.º 2
0
        public void OnResult(S s, string c = null)
        {
            switch (s)
            {
            case S.Failed:
                Do(s, c, OnFail, warnOnFail);                   break;

            case S.MaxIterExceeded:
                Do(s, c, OnMaxIterOverflow, warnOnOverflow);    break;

            case S.CapacityExceeded:
                Do(s, c, OnCapacityOverflow, warnOnOverflow);   break;
            }
        }
Ejemplo n.º 3
0
        public bool Block(S s)
        {
            switch (s)
            {
            case S.Failed:
                return(OnFail == Policy.Err);

            case S.MaxIterExceeded:
                return(OnMaxIterOverflow == Policy.Err);

            case S.CapacityExceeded:
                return(OnCapacityOverflow == Policy.Err);

            default:
                return(false);
            }
        }
Ejemplo n.º 4
0
        void Do(S s, string c, Policy policy, bool warn)
        {
            switch (policy)
            {
            case Policy.Stop:
                if (warn)
                {
                    Warn(s, c);
                }
                break;

            case Policy.Restart:
                if (warn)
                {
                    Warn(s, c);
                }
                break;

            default:
                Err(s, c);                                      break;
            }
        }
Ejemplo n.º 5
0
        [Test] public void NoActionCases(
            [Values(S.Done, S.Running, S.MaxIterExceeded,
                    S.CapacityExceeded)] S s,
            [Values(true, false)] bool warnOnFail,
            [Values(true, false)] bool warnOnOverflow)
        {
            x.warnOnFail     = warnOnFail;
            x.warnOnOverflow = warnOnOverflow;
        #if UNITY_2018_1_OR_NEWER
            switch (s)
            {
            case S.MaxIterExceeded:
                LogAssert.Expect(LogType.Error, ": MaxIterExceeded");
                break;

            case S.CapacityExceeded:
                LogAssert.Expect(LogType.Error, ": CapacityExceeded");
                break;
            }
        #endif
            x.OnResult(s);
            o(x.Block(s), s == S.MaxIterExceeded || s == S.CapacityExceeded);
        }
Ejemplo n.º 6
0
 void Err(S s, string c) => Console.WriteLine($"{c}: {s}");
Ejemplo n.º 7
0
 void Err(S s, string c) => Debug.LogError($"{c}: {s}");
Ejemplo n.º 8
0
 void Warn(S s, string c) => Debug.LogWarning($"{c}: {s}");