[Test] public void FuncStepEmptySeq([Values(false, true)] bool loop,
                                     [Range(0, 2)]         int flow)
 {
     x      = Sequence();
     x.loop = loop; FlowForInt(x, flow);
     o(((status)x).complete);
 }
 [Test] public void FuncStepEmptySel([Values(false, true)] bool loop,
                                     [Range(0, 2)]         int flow)
 {
     x      = Selector();
     x.loop = loop; FlowForInt(x, flow);
     o(((status)x).failing);
 }
 [Test] public void FuncStepSingletonSeq([Range(-1, +1)]       int val,
                                         [Values(false, true)] bool loop,
                                         [Range(0, 2)]         int flow)
 {
     x      = Sequence(() => new status(val));
     x.loop = loop; FlowForInt(x, flow);
     o(((status)x), new status(val));
 }
    [Test] public void TestProgressive()
    {
        var seq = MComposite.Sequence(new List <Func <status> > {
            () => to(4), () => to(10), () => to(15)
        });

        seq.loop = false;
        o(seq.progressive);
        RunSeq(seq);
    }
 [Test] public void MakeSequence()
 {
     x = Sequence();
     o(x.loop, true);
     o(x.current.complete);
     o(x.dither, true);
     o(x.progressive);
     o(x.isSelector, false);
     o(x.isSequence, true);
 }
 [Test] public void MakeSelector()
 {
     x = Selector();
     o(x.loop, true);
     o(x.current.failing);
     o(x.dither, true);
     o(x.progressive, true);
     o(x.isSelector, true);
     o(x.isSequence, false);
 }
    [Test] public void TestOrdered()
    {
        var tasks = new List <Func <status> > {
            () => to(4), () => to(10), () => to(15)
        };
        var seq = MComposite.Sequence(tasks);

        seq.loop    = false;
        seq.ordered = true;
        RunSeq(seq);
    }
    [Test] public void MakeSequenceVsMakeSelector()
    {
        x = MComposite.Sequence();
        var y = MComposite.Selector();

        o(x.loop, y.loop);
        o(x.current, !y.current);
        o(x.dither, y.dither);
        o(x.isSelector, !y.isSelector);
        o(x.isSequence, !y.isSequence);
    }
    void RunSeq(MComposite c)
    {
        status s = fail; for (int j = 0; !s.complete; j++)

        {
            s = c;
            if (j >= MaxIter)
            {
                throw new Ex("Too many iterations");
            }
        }
        o(foo, 15);
    }
    // ------------------------------------------------------------------------

    void FlowForInt(MComposite x, int val)
    {
        switch (val)
        {
        case 0: x.progressive = true; return;

        case 1: x.ordered = true; return;

        case 2: x.concurrent = true; return;

        default: throw new Exception();
        }
    }
示例#11
0
    [Test] public void B_325_ProgressiveΛSequence()
    {
        foo        = 0;
        status.log = false;
        var c = MComposite.Sequence(
            new Func <status>[] {
            () => to(4),
            () => to(10),
            () => to(15),
            () => reset()
        });

        c.progressive = true;
        status s;

        for (int j = 0; j < PerfTestIters; j++)
        {
            s = c;
        }
    }
示例#12
0
    [Test] public void B__50_OrderedΛSequence()
    {
        foo        = 0;
        status.log = false;
        var c = MComposite.Sequence(
            new Func <status>[] {
            () => to(4),
            () => to(10),
            () => to(15),
            () => reset()
        });

        c.ordered = true;
        c.loop    = true;
        status s;

        for (int j = 0; j < PerfTestIters; j++)
        {
            s = c;
        }
    }
 [Test] public void MkSeqWithList() => x = Sequence(new List <Func <status> >());
 [Test] public void MkSelWithList() => x = Selector(new List <Func <status> >());
 [SetUp] public void Setup()
 {
     status.log = false;
     x          = new MComposite();
 }