Example #1
0
        public void ExecuteIn(Vm vm)
        {
            var   lhs = lhExpr.EvalInt(vm);
            RelOp relOp;

            if (relop.s == ">")
            {
                relOp = new GT();
            }
            else if (relop.s == ">=")
            {
                relOp = new GTE();
            }
            else if (relop.s == "<")
            {
                relOp = new LT();
            }
            else if (relop.s == "<=")
            {
                relOp = new LTE();
            }
            else if (relop.s == "<>")
            {
                relOp = new NEQ();
            }
            else
            {
                relOp = new EQ();
            }
            var rhs  = rhExpr.EvalInt(vm);
            var pass = relOp.Execute(lhs, rhs);

            if (pass)
            {
                statement.Command.ExecuteIn(vm);
            }
        }
Example #2
0
        /// <summary>
        /// Create a single component from XML data
        /// </summary>
        /// <param name="node">XML node containing component data</param>
        /// <returns>Created Component</returns>
        private static ComponentBase CreateComponent(XmlNode node)
        {
            ComponentBase component;

            switch (node.LocalName)
            {
                #region Basic
            case "Coil":
                Coil coil = new Coil();
                coil.Mode = node.Attributes["Mode"].Value.ToEnum <Coil.CoilMode>();
                coil.Type = node.Attributes["Type"].Value.ToEnum <Coil.CoilType>();
                component = coil;
                break;

            case "Contact":
                Contact contact = new Contact();
                contact.IsClosed   = node.Attributes["IsClosed"].Value.ToBool();
                contact.IsInverted = node.Attributes["IsInverted"].Value.ToBool();
                contact.Type       = node.Attributes["Type"].Value.ToEnum <Contact.ContactType>();
                component          = contact;
                break;

            case "SC": component = new SC(); break;

            case "OSF": component = new OSF(); break;

            case "OSR": component = new OSR(); break;
                #endregion Basic

                #region Compare Components
            case "EQU": component = new EQU(); break;

            case "GEQ": component = new GEQ(); break;

            case "GRT": component = new GRT(); break;

            case "LEG": component = new LEG(); break;

            case "LES": component = new LES(); break;

            case "NEQ": component = new NEQ(); break;
                #endregion Compare Components

                #region Counter Components
            case "CTC": component = new CTC(); break;

            case "CTD": component = new CTD(); break;

            case "CTU": component = new CTU(); break;

            case "RES": component = new RES(); break;
                #endregion Counter Components

                #region Math Components
            case "ADD": component = new ADD(); break;

            case "DIV": component = new DIV(); break;

            case "MUL": component = new MUL(); break;

            case "SUB": component = new SUB(); break;

            case "MOV": component = new MOV(); break;
                #endregion Math Components

                #region Analog Components
            case "ADC":
                ADC adc = new ADC();
                adc.Destination = node.Attributes["Destination"].Value;
                component       = adc;
                break;

            case "PWM":
                PWM pwm = new PWM();
                pwm.DudyCycle = node.Attributes["DudyCycle"].Value;
                component     = pwm;
                break;
                #endregion Analog Components

                #region Function Components
            case "ELF":
                ELF elf = new ELF();
                elf.Name  = node.Attributes["Name"].Value;
                elf.Code  = node.InnerText;
                component = elf;
                break;
                #endregion Function Components

            default:
                throw new ArgumentException("Unknow Component", "node");
            }

            component.Comment = node.Attributes["Comment"].Value;

            #region Extra Processing based on Components Base Class
            if (component is NameableComponent)
            {
                (component as NameableComponent).Name = node.Attributes["Name"].Value;
            }

            if (component is CompareComponent)
            {
                (component as CompareComponent).VarA = node.Attributes["VarA"].Value;
                (component as CompareComponent).VarB = node.Attributes["VarB"].Value;
            }
            else if (component is CounterComponent)
            {
                (component as CounterComponent).Limit = node.Attributes["Limit"].Value;
            }
            else if (component is MathComponent)
            {
                (component as MathComponent).Destination = node.Attributes["Destination"].Value;
                (component as MathComponent).VarA        = node.Attributes["VarA"].Value;
                (component as MathComponent).VarB        = node.Attributes["VarB"].Value;
            }
            #endregion Extra Processing based on Components Base Class

            return(component);
        }
Example #3
0
        private void initOperators()
        {
            setName(NEG, "-");
            operators[NEG.operatorIndex()] = new[] {
                unary(NEG, TypeTag.INT, TypeTag.INT),
                unary(NEG, TypeTag.LONG, TypeTag.LONG),
                unary(NEG, TypeTag.FLOAT, TypeTag.DOUBLE),
                unary(NEG, TypeTag.DOUBLE, TypeTag.DOUBLE),
            };

            setName(NOT, "!");
            operators[NOT.operatorIndex()] = new[] {
                unary(NOT, TypeTag.BOOLEAN, TypeTag.BOOLEAN)
            };

            setName(COMPL, "~");
            operators[COMPL.operatorIndex()] = new[] {
                unary(COMPL, TypeTag.INT, TypeTag.INT),
                unary(COMPL, TypeTag.LONG, TypeTag.LONG)
            };

            setName(PRE_INC, "++");
            operators[PRE_INC.operatorIndex()] = new[] {
                unary(PRE_INC, TypeTag.INT, TypeTag.INT, LLVMAdd),
                unary(PRE_INC, TypeTag.LONG, TypeTag.LONG, LLVMAdd),
                unary(PRE_INC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFAdd),
                unary(PRE_INC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFAdd)
            };

            setName(PRE_DEC, "--");
            operators[PRE_DEC.operatorIndex()] = new[] {
                unary(PRE_DEC, TypeTag.INT, TypeTag.INT, LLVMSub),
                unary(PRE_DEC, TypeTag.LONG, TypeTag.LONG, LLVMSub),
                unary(PRE_DEC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFSub),
                unary(PRE_DEC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFSub)
            };

            setName(POST_INC, "++");
            operators[POST_INC.operatorIndex()] = new[] {
                unary(POST_INC, TypeTag.INT, TypeTag.INT, LLVMAdd),
                unary(POST_INC, TypeTag.LONG, TypeTag.LONG, LLVMAdd),
                unary(POST_INC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFAdd),
                unary(POST_INC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFAdd)
            };

            setName(POST_DEC, "--");
            operators[POST_DEC.operatorIndex()] = new[] {
                unary(POST_DEC, TypeTag.INT, TypeTag.INT, LLVMSub),
                unary(POST_DEC, TypeTag.LONG, TypeTag.LONG, LLVMSub),
                unary(POST_DEC, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFSub),
                unary(POST_DEC, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFSub)
            };

            setName(OR, "||");
            operators[OR.operatorIndex()] = new[] {
                binary(OR, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMOr),
            };

            setName(AND, "&&");
            operators[AND.operatorIndex()] = new[] {
                binary(AND, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMAnd),
            };

            // Order of combination listing for binary operators matters for correct resolution
            // More assignable types must be listed after less assignable ones,
            // which is the order listed in the TypeTag enum.

            setName(BITOR, "|");
            operators[BITOR.operatorIndex()] = new[] {
                binary(BITOR, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMOr),
                binary(BITOR, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMOr),
                binary(BITOR, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMOr),
            };

            setName(BITXOR, "^");
            operators[BITXOR.operatorIndex()] = new[] {
                binary(BITXOR, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMXor),
                binary(BITXOR, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMXor),
                binary(BITXOR, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMXor),
            };

            setName(BITAND, "&");
            operators[BITAND.operatorIndex()] = new[] {
                binary(BITAND, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMAnd),
                binary(BITAND, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMAnd),
                binary(BITAND, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMAnd),
            };

            setName(EQ, "==");
            operators[EQ.operatorIndex()] = new[] {
                binary(EQ, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntEQ),
                binary(EQ, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOEQ),
                binary(EQ, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOEQ),
            };

            setName(NEQ, "!=");
            operators[NEQ.operatorIndex()] = new[] {
                binary(NEQ, TypeTag.BOOLEAN, TypeTag.BOOLEAN, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntNE),
                binary(NEQ, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealONE),
                binary(NEQ, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealONE),
            };

            setName(LT, "<");
            operators[LT.operatorIndex()] = new[] {
                binary(LT, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntULT),
                binary(LT, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLT),
                binary(LT, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLT),
                binary(LT, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLT),
                binary(LT, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLT),
            };

            setName(GT, ">");
            operators[GT.operatorIndex()] = new[] {
                binary(GT, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntUGT),
                binary(GT, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGT),
                binary(GT, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGT),
                binary(GT, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGT),
                binary(GT, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGT),
            };

            setName(LE, "<=");
            operators[LE.operatorIndex()] = new[] {
                binary(LE, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntULE),
                binary(LE, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLE),
                binary(LE, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSLE),
                binary(LE, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLE),
                binary(LE, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOLE),
            };

            setName(GE, ">=");
            operators[GE.operatorIndex()] = new[] {
                binary(GE, TypeTag.CHAR, TypeTag.CHAR, TypeTag.BOOLEAN, LLVMICmp, LLVMIntUGE),
                binary(GE, TypeTag.INT, TypeTag.INT, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGE),
                binary(GE, TypeTag.LONG, TypeTag.LONG, TypeTag.BOOLEAN, LLVMICmp, LLVMIntSGE),
                binary(GE, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGE),
                binary(GE, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.BOOLEAN, LLVMFCmp, LLVMRealOGE),
            };

            setName(SHL, "<<");
            operators[SHL.operatorIndex()] = new[] {
                binary(SHL, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMShl),
                binary(SHL, TypeTag.INT, TypeTag.LONG, TypeTag.INT, LLVMShl),
                binary(SHL, TypeTag.LONG, TypeTag.INT, TypeTag.LONG, LLVMShl),
                binary(SHL, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMShl),
            };

            setName(SHR, ">>");
            operators[SHR.operatorIndex()] = new[] {
                binary(SHR, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMLShr),
                binary(SHR, TypeTag.INT, TypeTag.LONG, TypeTag.INT, LLVMLShr),
                binary(SHR, TypeTag.LONG, TypeTag.INT, TypeTag.LONG, LLVMLShr),
                binary(SHR, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMLShr),
            };

            setName(PLUS, "+");
            operators[PLUS.operatorIndex()] = new[] {
                binary(PLUS, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMAdd),
                binary(PLUS, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMAdd),
                binary(PLUS, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFAdd),
                binary(PLUS, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFAdd),
            };

            setName(MINUS, "-");
            operators[MINUS.operatorIndex()] = new[] {
                binary(MINUS, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMSub),
                binary(MINUS, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMSub),
                binary(MINUS, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFSub),
                binary(MINUS, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFSub),
            };

            setName(MUL, "*");
            operators[MUL.operatorIndex()] = new[] {
                binary(MUL, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMMul),
                binary(MUL, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMMul),
                binary(MUL, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFMul),
                binary(MUL, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFMul),
            };

            setName(DIV, "/");
            operators[DIV.operatorIndex()] = new[] {
                binary(DIV, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMSDiv),
                binary(DIV, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMSDiv),
                binary(DIV, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFDiv),
                binary(DIV, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFDiv),
            };

            setName(MOD, "%");
            operators[MOD.operatorIndex()] = new[] {
                binary(MOD, TypeTag.INT, TypeTag.INT, TypeTag.INT, LLVMSRem),
                binary(MOD, TypeTag.LONG, TypeTag.LONG, TypeTag.LONG, LLVMSRem),
                binary(MOD, TypeTag.FLOAT, TypeTag.FLOAT, TypeTag.FLOAT, LLVMFRem),
                binary(MOD, TypeTag.DOUBLE, TypeTag.DOUBLE, TypeTag.DOUBLE, LLVMFRem),
            };
        }
Example #4
0
        public void Compare()
        {
            #region Startup
            var  TestTable = new LadderDataTable();
            Node PowerRail = new Node();

            EQU equ = new EQU();
            equ.LeftLide  = PowerRail;
            equ.VarA      = "VarA";
            equ.VarB      = "VarB";
            equ.DataTable = TestTable;

            GEQ geq = new GEQ();
            geq.LeftLide  = PowerRail;
            geq.VarA      = "VarA";
            geq.VarB      = "VarB";
            geq.DataTable = TestTable;

            GRT grt = new GRT();
            grt.LeftLide  = PowerRail;
            grt.VarA      = "VarA";
            grt.VarB      = "VarB";
            grt.DataTable = TestTable;

            LEG leg = new LEG();
            leg.LeftLide  = PowerRail;
            leg.VarA      = "VarA";
            leg.VarB      = "VarB";
            leg.DataTable = TestTable;

            LES les = new LES();
            les.LeftLide  = PowerRail;
            les.VarA      = "VarA";
            les.VarB      = "VarB";
            les.DataTable = TestTable;

            NEQ neq = new NEQ();
            neq.LeftLide  = PowerRail;
            neq.VarA      = "VarA";
            neq.VarB      = "VarB";
            neq.DataTable = TestTable;
            #endregion Startup

            #region EQU
            Trace.WriteLine("EQU", "Unit Test");
            Trace.Indent();

            Trace.WriteLine("Input False", "EQU");
            Trace.Indent();
            PowerRail.LogicLevel = false;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(equ.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(equ.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsFalse(equ.Execute());
            Trace.Unindent();

            Trace.WriteLine("Input True", "EQU");
            Trace.Indent();
            PowerRail.LogicLevel = true;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsTrue(equ.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(equ.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsFalse(equ.Execute());
            Trace.Unindent();
            Trace.Unindent();
            #endregion EQU

            #region GEQ
            Trace.WriteLine("GEQ", "Unit Test");
            Trace.Indent();

            Trace.WriteLine("Input False", "GEQ");
            Trace.Indent();
            PowerRail.LogicLevel = false;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(geq.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(geq.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsFalse(geq.Execute());
            Trace.Unindent();

            Trace.WriteLine("Input True", "GEQ");
            Trace.Indent();
            PowerRail.LogicLevel = true;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsTrue(geq.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(geq.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsTrue(geq.Execute());
            Trace.Unindent();
            Trace.Unindent();
            #endregion GEQ

            #region GRT
            Trace.WriteLine("GRT", "Unit Test");
            Trace.Indent();

            Trace.WriteLine("Input False", "GRT");
            Trace.Indent();
            PowerRail.LogicLevel = false;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            grt.Execute();
            Assert.IsFalse(grt.InternalState);

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            grt.Execute();
            Assert.IsFalse(grt.InternalState);

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            grt.Execute();
            Assert.IsFalse(grt.InternalState);
            Trace.Unindent();

            Trace.WriteLine("Input True", "GRT");
            Trace.Indent();
            PowerRail.LogicLevel = true;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            grt.Execute();
            Assert.IsFalse(grt.InternalState);

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            grt.Execute();
            Assert.IsFalse(grt.InternalState);

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            grt.Execute();
            Assert.IsTrue(grt.InternalState);
            Trace.Unindent();
            Trace.Unindent();
            #endregion GRT

            #region LEG
            Trace.WriteLine("LEG", "Unit Test");
            Trace.Indent();

            Trace.WriteLine("Input False", "LEG");
            Trace.Indent();
            PowerRail.LogicLevel = false;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            leg.Execute();
            Assert.IsFalse(leg.InternalState);

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            leg.Execute();
            Assert.IsFalse(leg.InternalState);

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            leg.Execute();
            Assert.IsFalse(leg.InternalState);
            Trace.Unindent();

            Trace.WriteLine("Input True", "LEG");
            Trace.Indent();
            PowerRail.LogicLevel = true;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            leg.Execute();
            Assert.IsTrue(leg.InternalState);

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            leg.Execute();
            Assert.IsTrue(leg.InternalState);

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            leg.Execute();
            Assert.IsFalse(leg.InternalState);
            Trace.Unindent();
            Trace.Unindent();
            #endregion LEG

            #region LES
            Trace.WriteLine("LES", "Unit Test");
            Trace.Indent();

            Trace.WriteLine("Input False", "LES");
            Trace.Indent();
            PowerRail.LogicLevel = false;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(les.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(les.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsFalse(les.Execute());
            Trace.Unindent();

            Trace.WriteLine("Input True", "LES");
            Trace.Indent();
            PowerRail.LogicLevel = true;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(les.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsTrue(les.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsFalse(les.Execute());
            Trace.Unindent();
            Trace.Unindent();
            #endregion LES

            #region NEQ
            Trace.WriteLine("NEQ", "Unit Test");
            Trace.Indent();

            Trace.WriteLine("Input False", "NEQ");
            Trace.Indent();
            PowerRail.LogicLevel = false;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(neq.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(neq.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsFalse(neq.Execute());
            Trace.Unindent();

            Trace.WriteLine("Input True", "NEQ");
            Trace.Indent();
            PowerRail.LogicLevel = true;

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)1);
            Assert.IsFalse(neq.Execute());

            TestTable.SetValue(0, (short)0);
            TestTable.SetValue(1, (short)1);
            Assert.IsTrue(neq.Execute());

            TestTable.SetValue(0, (short)1);
            TestTable.SetValue(1, (short)0);
            Assert.IsTrue(neq.Execute());
            Trace.Unindent();
            Trace.Unindent();
            #endregion NEQ
        }