public void Init3() { TFrac leftFrac = new TFrac(16, 4); TFrac rightFrac = new TFrac(17, 9); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); string answer = "17/9"; Assert.AreEqual(answer, proc.Rop.ToString()); }
public void Init2() { TFrac leftFrac = new TFrac(11, 3); TFrac rightFrac = new TFrac(); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); string answer = "11/3"; Assert.AreEqual(answer, proc.Lop_Res.ToString()); }
public void TestFState2() { TFrac leftFrac = new TFrac(56, 7); TFrac rightFrac = new TFrac(-22, 3); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); proc.DoFunc(TProc <TFrac> .Func.Sqr); string answer = "484/9"; Assert.AreEqual(answer, proc.Rop.ToString()); }
public void Operation4() { TFrac leftFrac = new TFrac(56, 7); TFrac rightFrac = new TFrac(-22, 3); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); proc.Operation = TProc <TFrac> .Oper.Div; proc.DoOper(); string answer = "-12/11"; Assert.AreEqual(answer, proc.Lop_Res.ToString()); }
public void Operation3() { TFrac leftFrac = new TFrac(12, 7); TFrac rightFrac = new TFrac(5, 9); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); proc.Operation = TProc <TFrac> .Oper.Mul; proc.DoOper(); string answer = "20/21"; Assert.AreEqual(answer, proc.Lop_Res.ToString()); }
public void Operation2() { TFrac leftFrac = new TFrac(3, 4); TFrac rightFrac = new TFrac(5, 6); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); proc.Operation = TProc <TFrac> .Oper.Sub; proc.DoOper(); string answer = "-1/12"; Assert.AreEqual(answer, proc.Lop_Res.ToString()); }
public void Operation1() { TFrac leftFrac = new TFrac(1, 2); TFrac rightFrac = new TFrac(1, 2); TProc <TFrac> proc = new TProc <TFrac>(leftFrac, rightFrac); proc.Operation = TProc <TFrac> .Oper.Add; proc.DoOper(); string answer = "1/1"; Assert.AreEqual(answer, proc.Lop_Res.ToString()); }
static void Main(string[] args) { ModbusClient mbus_client; S7Client s7_client; TProc tp = new TProc(); string ans; Console.WriteLine("Select mode of operation:\n(M)odbus, (S)7Comm"); ans = Console.ReadLine(); if (ans == "M" || ans == "m") { mbus_client = new ModbusClient("127.0.0.1", 502); try { mbus_client.Connect(); } catch { Console.WriteLine("Cannot connect via Modbus TCP, aborting execution"); return; } Console.WriteLine("Succesfully connected via Modbus TCP, starting ticking..."); while (true) { Thread.Sleep(1000); tp.Tick(mbus_client); } } else if (ans == "S" || ans == "s") { s7_client = new S7Client(); try { s7_client.ConnectTo("192.168.56.101", 0, 2); } catch { Console.WriteLine("Cannot connect via S7 Comm, aborting execution"); return; } Console.WriteLine("Succesfully connected via S7 Comm, starting ticking..."); while (true) { Thread.Sleep(1000); tp.Tick(s7_client); } } else { Console.WriteLine("Invalid mode of operation"); } }