Beispiel #1
0
        public void Anon_11(Event currentMachine_dequeuedEvent)
        {
            Door    currentMachine = this;
            PrtBool TMP_tmp0_10    = ((PrtBool)false);
            PEvent  TMP_tmp1_9     = null;
            PrtBool TMP_tmp2_4     = ((PrtBool)false);
            PEvent  TMP_tmp3_3     = null;

            TMP_tmp0_10 = (PrtBool)(((PrtBool)currentMachine.TryRandomBool()));
            if (TMP_tmp0_10)
            {
                TMP_tmp1_9 = (PEvent)(new eUnit(null));
                currentMachine.TryRaiseEvent((Event)TMP_tmp1_9);
                return;
            }
            else
            {
                TMP_tmp2_4 = (PrtBool)(((PrtBool)currentMachine.TryRandomBool()));
                if (TMP_tmp2_4)
                {
                    TMP_tmp3_3 = (PEvent)(new eObjectEncountered(null));
                    currentMachine.TryRaiseEvent((Event)TMP_tmp3_3);
                    return;
                }
            }
        }
Beispiel #2
0
        public void TestPrtBoolOverloading()
        {
            PrtBool boolT = true;
            PrtBool boolF = false;

            Assert.AreEqual(boolT, boolF || boolT);
            Assert.AreEqual(boolT, boolT || boolF);
            Assert.AreEqual(boolT, !boolF);
            Assert.AreEqual(boolF, boolT && boolF);
            Assert.AreEqual(boolT, boolT && boolT);
        }
Beispiel #3
0
        public void Anon_4(Event currentMachine_dequeuedEvent)
        {
            Elevator currentMachine = this;
            PrtBool  TMP_tmp0_4     = ((PrtBool)false);
            PEvent   TMP_tmp1_4     = null;

            TMP_tmp0_4 = (PrtBool)(((PrtBool)currentMachine.TryRandomBool()));
            if (TMP_tmp0_4)
            {
                TMP_tmp1_4 = (PEvent)(new eCloseDoor(null));
                currentMachine.TryRaiseEvent((Event)TMP_tmp1_4);
                return;
            }
        }
Beispiel #4
0
        public void TestPrtIntComparisions()
        {
            PrtBool boolT = true;
            PrtBool boolF = false;

            Assert.AreEqual(boolT, PrtValues.Box(1) < PrtValues.Box(2));
            Assert.AreEqual(boolF, PrtValues.Box(1) < PrtValues.Box(1));
            Assert.AreEqual(boolT, PrtValues.Box(1) <= PrtValues.Box(1));
            Assert.AreEqual(boolT, PrtValues.Box(1) <= PrtValues.Box(2));
            Assert.AreEqual(boolT, PrtValues.Box(1) == PrtValues.Box(1));
            Assert.AreEqual(boolT, PrtValues.Box(1) != PrtValues.Box(2));
            Assert.AreEqual(boolT, PrtValues.Box(1) >= PrtValues.Box(1));
            Assert.AreEqual(boolT, PrtValues.Box(1) >= PrtValues.Box(0));
            Assert.AreEqual(boolT, PrtValues.Box(1) > PrtValues.Box(0));
        }
Beispiel #5
0
        public void TestPrtFloatComparisions()
        {
            PrtBool boolT = true;
            PrtBool boolF = false;

            Assert.AreEqual(boolT, PrtValues.Box(1.0) < PrtValues.Box(2.0));
            Assert.AreEqual(boolF, PrtValues.Box(1.0) < PrtValues.Box(1.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) <= PrtValues.Box(1.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) <= PrtValues.Box(2.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) == PrtValues.Box(1.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) != PrtValues.Box(2.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) >= PrtValues.Box(1.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) >= PrtValues.Box(0.0));
            Assert.AreEqual(boolT, PrtValues.Box(1.0) > PrtValues.Box(0.0));
        }
Beispiel #6
0
        public void Anon_5()
        {
            ServiceMachine currentMachine = this;
            PrtBool        TMP_tmp0_6     = ((PrtBool)false);
            PrtInt         TMP_tmp1_5     = ((PrtInt)0);
            PrtBool        TMP_tmp2_5     = ((PrtBool)false);

            TMP_tmp0_6 = !(donej);
            if (TMP_tmp0_6)
            {
                TMP_tmp1_5 = (j) + (((PrtInt)1));
                j          = TMP_tmp1_5;
                donej      = ((PrtBool)true);
            }
            donei      = ((PrtBool)false);
            TMP_tmp2_5 = (i) == (j);
            currentMachine.Assert(TMP_tmp2_5, "");
        }
Beispiel #7
0
        public void Anon_3()
        {
            Hello   currentMachine = this;
            PrtBool b          = ((PrtBool)false);
            PrtBool TMP_tmp0_5 = ((PrtBool)false);

            TMP_tmp0_5 = (PrtBool)(GlobalFunctions.Continue(this));
            b          = TMP_tmp0_5;
            if (b)
            {
                currentMachine.GotoState <Hello.PrintHello>();
                throw new PUnreachableCodeException();
            }
            else
            {
                currentMachine.GotoState <Hello.Stop>();
                throw new PUnreachableCodeException();
            }
        }
Beispiel #8
0
        public void Anon_8(Event currentMachine_dequeuedEvent)
        {
            Main          currentMachine = this;
            PrtBool       TMP_tmp0_8     = ((PrtBool)false);
            PMachineValue TMP_tmp1_7     = null;
            PEvent        TMP_tmp2_2     = null;
            PrtBool       TMP_tmp3_2     = ((PrtBool)false);
            PMachineValue TMP_tmp4_1     = null;
            PEvent        TMP_tmp5       = null;
            PrtBool       TMP_tmp6       = ((PrtBool)false);
            PEvent        TMP_tmp7       = null;
            PrtInt        TMP_tmp8       = ((PrtInt)0);

            TMP_tmp0_8 = (PrtBool)(((PrtBool)currentMachine.TryRandomBool()));
            if (TMP_tmp0_8)
            {
                TMP_tmp1_7 = (PMachineValue)(((PMachineValue)((IPrtValue)ElevatorV)?.Clone()));
                TMP_tmp2_2 = (PEvent)(new eOpenDoor(null));
                currentMachine.TrySendEvent(TMP_tmp1_7, (Event)TMP_tmp2_2);
            }
            else
            {
                TMP_tmp3_2 = (PrtBool)(((PrtBool)currentMachine.TryRandomBool()));
                if (TMP_tmp3_2)
                {
                    TMP_tmp4_1 = (PMachineValue)(((PMachineValue)((IPrtValue)ElevatorV)?.Clone()));
                    TMP_tmp5   = (PEvent)(new eCloseDoor(null));
                    currentMachine.TrySendEvent(TMP_tmp4_1, (Event)TMP_tmp5);
                }
            }
            TMP_tmp6 = (PrtBool)((PrtValues.SafeEquals(count, ((PrtInt)5))));
            if (TMP_tmp6)
            {
                TMP_tmp7 = (PEvent)(new PHalt(null));
                currentMachine.TryRaiseEvent((Event)TMP_tmp7);
                return;
            }
            TMP_tmp8 = (PrtInt)((count) + (((PrtInt)1)));
            count    = TMP_tmp8;
            currentMachine.TryGotoState <Main.Loop>();
            return;
        }
Beispiel #9
0
        public void Anon_4()
        {
            ServiceMachine currentMachine = this;
            PrtBool        TMP_tmp0_5     = ((PrtBool)false);
            PrtInt         TMP_tmp1_4     = ((PrtInt)0);
            PrtInt         TMP_tmp2_4     = ((PrtInt)0);
            PrtBool        TMP_tmp3_4     = ((PrtBool)false);

            TMP_tmp0_5 = !(donei);
            if (TMP_tmp0_5)
            {
                TMP_tmp1_4 = (i) + (((PrtInt)1));
                i          = TMP_tmp1_4;
                donei      = ((PrtBool)true);
            }
            donej      = ((PrtBool)false);
            TMP_tmp2_4 = (j) + (((PrtInt)1));
            TMP_tmp3_4 = (i) == (TMP_tmp2_4);
            currentMachine.Assert(TMP_tmp3_4, "");
        }
Beispiel #10
0
        public async Task Anon_1(Event currentMachine_dequeuedEvent)
        {
            FaultTolerantMachine currentMachine         = this;
            PrtTuple <PMachineValue, PMachineValue> arg = ((PEvent <PrtTuple <PMachineValue, PMachineValue> >)currentMachine_dequeuedEvent).PayloadT;
            PMachineValue     TMP_tmp0_1 = null;
            PMachineValue     TMP_tmp1_1 = null;
            PMachineValue     TMP_tmp2_1 = null;
            IEventWithPayload TMP_tmp3_1 = null;
            PMachineValue     TMP_tmp4_1 = null;
            PrtBool           TMP_tmp5_1 = ((PrtBool)false);

            TMP_tmp0_1        = arg.Item1;
            service_1         = TMP_tmp0_1;
            TMP_tmp1_1        = arg.Item2;
            reliableStorage_1 = TMP_tmp1_1;
            TMP_tmp2_1        = ((PMachineValue)((IPrtValue)reliableStorage_1)?.Clone());
            TMP_tmp3_1        = new eQueryState(null);
            TMP_tmp4_1        = currentMachine.self;
            currentMachine.SendEvent(currentMachine, TMP_tmp2_1, (Event)TMP_tmp3_1, TMP_tmp4_1);
            var PGEN_recvEvent = await currentMachine.ReceiveEvent(typeof(eQueryStateResponse));

            switch (PGEN_recvEvent)
            {
            case eQueryStateResponse PGEN_evt: {
                var s = PGEN_evt.PayloadT;
                TMP_tmp5_1 = ((long)s) == ((long)((PrtInt)(long)MyState.State0));
                if (TMP_tmp5_1)
                {
                    currentMachine.GotoState <FaultTolerantMachine.State0>();
                    throw new PUnreachableCodeException();
                }
                else
                {
                    currentMachine.GotoState <FaultTolerantMachine.State1>();
                    throw new PUnreachableCodeException();
                }
            } break;
            }
        }