public void ExpressionParserVariableParseTest()
        {
            CircuitProject    project = ProjectTester.Load(this.TestContext, Properties.Resources.Digital_Clock, "4 bit adder");
            CircuitTestSocket socket  = new CircuitTestSocket(project.ProjectSet.Project.LogicalCircuit);
            ExpressionParser  parser  = new ExpressionParser(socket);
            TruthState        state   = new TruthState(socket.Inputs.Count(), socket.Outputs.Count());

            for (int i = 0; i < state.Result.Length; i++)
            {
                state.Result[i] = 0x5555555555555555L;
            }
            bool success = state.Unpack(socket.Outputs.Select(o => o.Function.ParameterCount).ToArray());

            Assert.IsTrue(success);

            state.Input[this.InputIndex(socket, "c")]    = 1;
            state.Input[this.InputIndex(socket, "x1")]   = 5;
            state.Input[this.InputIndex(socket, "x2")]   = 4;
            state.Output[this.OutputIndex(socket, "s")]  = 9;
            state.Output[this.OutputIndex(socket, "c'")] = 1;

            this.Valid(parser, state, 1, "c");
            this.Valid(parser, state, 5, "x1");
            this.Valid(parser, state, 4, "x2");
            this.Valid(parser, state, 9, "s");
            this.Valid(parser, state, 1, "\"c'\"");

            this.Invalid(parser, state, "d");
            this.Invalid(parser, state, "\"c'");
            this.Invalid(parser, state, "\"c'\\");
            this.Invalid(parser, state, "\"c'\\\"\"");
        }
        public void ExpressionParserVariableCaseParseTest()
        {
            CircuitProject project = ProjectTester.Load(this.TestContext, Properties.Resources.Digital_Clock, "4 bit adder");
            Pin            x1 = null, x2 = null, s = null, c = null;

            foreach (Pin pin in project.PinSet.SelectByCircuit(project.ProjectSet.Project.LogicalCircuit))
            {
                switch (pin.Name)
                {
                case "x1":
                    x1 = pin;
                    break;

                case "x2":
                    x2 = pin;
                    break;

                case "s":
                    s = pin;
                    break;

                case "c'":
                    c = pin;
                    break;
                }
            }
            Assert.IsNotNull(x1);
            Assert.IsNotNull(x2);
            Assert.IsNotNull(s);
            Assert.IsNotNull(c);
            project.InTransaction(() => {
                x1.Name = "variant";
                x2.Name = "vaRIAnt";
                s.Name  = "VAriaNT";
                c.Name  = "VARIANT";
            });

            CircuitTestSocket socket = new CircuitTestSocket(project.ProjectSet.Project.LogicalCircuit);
            ExpressionParser  parser = new ExpressionParser(socket);
            TruthState        state  = new TruthState(socket.Inputs.Count(), socket.Outputs.Count());

            for (int i = 0; i < state.Result.Length; i++)
            {
                state.Result[i] = 0x5555555555555555L;
            }
            state.Unpack(socket.Outputs.Select(o => o.Function.ParameterCount).ToArray());

            state.Input[this.InputIndex(socket, "c")]         = 1;
            state.Input[this.InputIndex(socket, "variant")]   = 5;
            state.Input[this.InputIndex(socket, "vaRIAnt")]   = 4;
            state.Output[this.OutputIndex(socket, "VAriaNT")] = 9;
            state.Output[this.OutputIndex(socket, "VARIANT")] = 1;

            this.Valid(parser, state, 1, "c");
            this.Valid(parser, state, 5, "variant");
            this.Valid(parser, state, 4, "vaRIAnt");
            this.Valid(parser, state, 9, "VAriaNT");
            this.Valid(parser, state, 1, "VARIANT");
        }