Esempio n. 1
0
        public SymbolicValue <TModel, TVar, TBool, TInt, TString> VisitZenArbitraryExpr <T1>(ZenArbitraryExpr <T1> expression, SymbolicEvaluationEnvironment <TModel, TVar, TBool, TInt, TString> parameter)
        {
            return(LookupOrCompute(expression, () =>
            {
                var type = typeof(T1);

                if (type == ReflectionUtilities.BoolType)
                {
                    var(variable, expr) = this.Solver.CreateBoolVar(expression);
                    this.Variables.Add(variable);
                    var result = new SymbolicBool <TModel, TVar, TBool, TInt, TString>(this.Solver, expr);
                    this.ArbitraryVariables[expression] = variable;
                    return result;
                }

                if (type == ReflectionUtilities.ByteType)
                {
                    var(variable, expr) = this.Solver.CreateByteVar(expression);
                    this.Variables.Add(variable);
                    var result = new SymbolicInteger <TModel, TVar, TBool, TInt, TString>(this.Solver, expr);
                    this.ArbitraryVariables[expression] = variable;
                    return result;
                }

                if (type == ReflectionUtilities.ShortType || type == ReflectionUtilities.UshortType)
                {
                    var(variable, expr) = this.Solver.CreateShortVar(expression);
                    this.Variables.Add(variable);
                    var result = new SymbolicInteger <TModel, TVar, TBool, TInt, TString>(this.Solver, expr);
                    this.ArbitraryVariables[expression] = variable;
                    return result;
                }

                if (type == ReflectionUtilities.IntType || type == ReflectionUtilities.UintType)
                {
                    var(variable, expr) = this.Solver.CreateIntVar(expression);
                    this.Variables.Add(variable);
                    var result = new SymbolicInteger <TModel, TVar, TBool, TInt, TString>(this.Solver, expr);
                    this.ArbitraryVariables[expression] = variable;
                    return result;
                }

                if (type == ReflectionUtilities.StringType)
                {
                    var(variable, expr) = this.Solver.CreateStringVar(expression);
                    this.Variables.Add(variable);
                    var result = new SymbolicString <TModel, TVar, TBool, TInt, TString>(this.Solver, expr);
                    this.ArbitraryVariables[expression] = variable;
                    return result;
                }

                // long or ulong
                var(v, e) = this.Solver.CreateLongVar(expression);
                this.Variables.Add(v);
                var r = new SymbolicInteger <TModel, TVar, TBool, TInt, TString>(this.Solver, e);
                this.ArbitraryVariables[expression] = v;
                return r;
            }));
        }