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)); }
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)); }
public void TestPrtIntOverloading() { PrtInt int1 = 1; PrtInt int2 = 2; PrtInt int3 = 3; Assert.AreEqual(int3, int1 + int2); Assert.AreEqual(int1, int3 - int2); Assert.AreEqual(int2, int1 * int2); Assert.AreEqual(int1, int3 / int2); Assert.AreEqual(PrtValues.Box(6), int1 + int2 + int3); Assert.AreEqual(PrtValues.Box(6), int1 * int2 * int3); Assert.AreEqual(int1, int3 / (int1 + int2)); Assert.AreEqual(-int1, int2 - int3); Assert.AreEqual(+int1, int1); Assert.AreEqual(int1, +int1); }
public void TestPrtFloatOverloading() { PrtFloat float1 = 1.0; PrtFloat float2 = 2.0; PrtFloat float3 = 3.0; Assert.AreEqual(float3, float1 + float2); Assert.AreEqual(float1, float3 - float2); Assert.AreEqual(float2, float1 * float2); Assert.AreEqual(PrtValues.Box(1.5), float3 / float2); Assert.AreEqual(PrtValues.Box(6.0), float1 + float2 + float3); Assert.AreEqual(PrtValues.Box(6.0), float1 * float2 * float3); Assert.AreEqual(float1, float3 / (float1 + float2)); Assert.AreEqual(-float1, float2 - float3); Assert.AreEqual(+float1, float1); Assert.AreEqual(float1, +float1); }
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; }
public async Task Anon_1() { var currentMachine = this; var TMP_tmp0_1 = (PrtBool)false; var TMP_tmp1_1 = (PrtBool)false; var TMP_tmp2_1 = (PrtInt)0; var TMP_tmp3_1 = (PrtInt)0; var TMP_tmp4_1 = (PrtInt)0; var TMP_tmp5_1 = (PrtBool)false; var TMP_tmp6_1 = (PrtInt)0; var TMP_tmp7_1 = (PrtInt)0; var TMP_tmp8_1 = (PrtBool)false; var TMP_tmp9 = (PrtInt)0; var TMP_tmp10 = (PrtInt)0; var TMP_tmp11 = (PrtBool)false; var TMP_tmp12 = (PrtBool)false; var TMP_tmp13 = (PrtInt)0; var TMP_tmp14 = (PrtBool)false; var TMP_tmp15 = (PrtBool)false; var TMP_tmp16 = (PrtBool)false; var TMP_tmp17 = (PrtInt)0; var TMP_tmp18 = (PrtBool)false; var TMP_tmp19 = (PrtBool)false; var TMP_tmp20 = (PrtBool)false; var TMP_tmp21 = (PrtInt)0; var TMP_tmp22 = (PrtBool)false; var TMP_tmp23 = (PrtBool)false; var TMP_tmp24 = (PrtBool)false; var TMP_tmp25 = (PrtBool)false; var TMP_tmp26 = (PrtBool)false; var TMP_tmp27 = (PrtInt)0; var TMP_tmp28 = (PrtBool)false; var TMP_tmp29 = (PrtInt)0; var TMP_tmp30 = (PrtBool)false; var TMP_tmp31 = (PrtBool)false; var TMP_tmp32 = (PrtBool)false; var TMP_tmp33 = (PrtInt)0; var TMP_tmp34 = (PrtBool)false; var TMP_tmp35 = (PrtInt)0; var TMP_tmp36 = (PrtBool)false; var TMP_tmp37 = (PrtInt)0; var TMP_tmp38 = (PrtBool)false; x = 10; y = new e1(null); var PGEN_recvEvent = await currentMachine.ReceiveEvent(typeof(e1)); switch (PGEN_recvEvent) { case e1 PGEN_evt: { var x_1 = (PrtInt)0; var y_1 = (PrtInt)0; var foo0 = (PrtInt)0; var Foo = (PrtInt)0; var a = (PrtInt)0; x_1 = 19; TMP_tmp0_1 = PrtValues.SafeEquals(x_1, (PrtInt)19); currentMachine.Assert(TMP_tmp0_1, ""); y_1 = 1; foo0 = 5; TMP_tmp1_1 = PrtValues.SafeEquals(foo0, (PrtInt)5); currentMachine.Assert(TMP_tmp1_1, ""); TMP_tmp2_1 = 0; TMP_tmp3_1 = TMP_tmp2_1; Foo = TMP_tmp3_1; TMP_tmp4_1 = PrtEnum.Get("bar0"); TMP_tmp5_1 = PrtValues.SafeEquals(Foo, TMP_tmp4_1); currentMachine.Assert(TMP_tmp5_1, ""); TMP_tmp6_1 = (PrtInt)((IPrtValue)y_1)?.Clone(); TMP_tmp7_1 = foo0_1(TMP_tmp6_1); z = TMP_tmp7_1; TMP_tmp8_1 = PrtValues.SafeEquals(z, (PrtInt)1); currentMachine.Assert(TMP_tmp8_1, ""); TMP_tmp9 = (PrtInt)((IPrtValue)y_1)?.Clone(); TMP_tmp10 = foo1(TMP_tmp9); z = TMP_tmp10; TMP_tmp11 = PrtValues.SafeEquals(z, (PrtInt)1); currentMachine.Assert(TMP_tmp11, ""); a = 3; ts["a"] = (PrtInt)5; TMP_tmp12 = PrtValues.SafeEquals(a, (PrtInt)3); currentMachine.Assert(TMP_tmp12, ""); TMP_tmp13 = (PrtInt)ts["a"]; TMP_tmp14 = PrtValues.SafeEquals(TMP_tmp13, (PrtInt)5); currentMachine.Assert(TMP_tmp14, ""); var PGEN_recvEvent_1 = await currentMachine.ReceiveEvent(typeof(e2)); switch (PGEN_recvEvent_1) { case e2 PGEN_evt_1: { TMP_tmp15 = PrtValues.SafeEquals(x_1, (PrtInt)19); currentMachine.Assert(TMP_tmp15, ""); TMP_tmp16 = PrtValues.SafeEquals(foo0, (PrtInt)5); currentMachine.Assert(TMP_tmp16, ""); TMP_tmp17 = PrtEnum.Get("bar0"); TMP_tmp18 = PrtValues.SafeEquals(Foo, TMP_tmp17); currentMachine.Assert(TMP_tmp18, ""); TMP_tmp19 = PrtValues.SafeEquals(z, (PrtInt)1); currentMachine.Assert(TMP_tmp19, ""); TMP_tmp20 = PrtValues.SafeEquals(a, (PrtInt)3); currentMachine.Assert(TMP_tmp20, ""); TMP_tmp21 = (PrtInt)ts["a"]; TMP_tmp22 = PrtValues.SafeEquals(TMP_tmp21, (PrtInt)5); currentMachine.Assert(TMP_tmp22, ""); TMP_tmp23 = PrtValues.SafeEquals(y_1, (PrtInt)1); currentMachine.Assert(TMP_tmp23, ""); TMP_tmp24 = PrtValues.SafeEquals(foo0, (PrtInt)5); currentMachine.Assert(TMP_tmp24, ""); } break; } } break; } var PGEN_recvEvent_2 = await currentMachine.ReceiveEvent(typeof(e3)); switch (PGEN_recvEvent_2) { case e3 PGEN_evt_2: { TMP_tmp25 = PrtValues.SafeEquals(x, (PrtInt)10); currentMachine.Assert(TMP_tmp25, ""); TMP_tmp26 = PrtValues.SafeEquals(y, new e1(null)); currentMachine.Assert(TMP_tmp26, ""); TMP_tmp27 = 0; TMP_tmp28 = PrtValues.SafeEquals(PrtValues.Box((long)TMP_tmp27), PrtValues.Box((long)PrtEnum.Get("foo0_2"))); currentMachine.Assert(TMP_tmp28, ""); TMP_tmp29 = (PrtInt)ts["a"]; TMP_tmp30 = PrtValues.SafeEquals(TMP_tmp29, (PrtInt)5); currentMachine.Assert(TMP_tmp30, ""); } break; } await bar(); TMP_tmp31 = PrtValues.SafeEquals(x, (PrtInt)10); currentMachine.Assert(TMP_tmp31, ""); TMP_tmp32 = PrtValues.SafeEquals(y, new e1(null)); currentMachine.Assert(TMP_tmp32, ""); TMP_tmp33 = PrtEnum.Get("foo0_2"); TMP_tmp34 = PrtValues.SafeEquals(TMP_tmp33, (PrtInt)0); currentMachine.Assert(TMP_tmp34, ""); TMP_tmp35 = 0; TMP_tmp36 = PrtValues.SafeEquals(PrtValues.Box((long)TMP_tmp35), PrtValues.Box((long)PrtEnum.Get("foo0_2"))); currentMachine.Assert(TMP_tmp36, ""); TMP_tmp37 = (PrtInt)ts["a"]; TMP_tmp38 = PrtValues.SafeEquals(TMP_tmp37, (PrtInt)5); currentMachine.Assert(TMP_tmp38, ""); }