Example #1
0
        private void AssertEq(Type type)
        {
            var ctx = _model.Context;
            var num = type.HasFlag(Type.Number) ? ctx.MkEq(_type, _model.NumType) : ctx.MkFalse();
            var str = type.HasFlag(Type.String) ? ctx.MkEq(_type, _model.StrType) : ctx.MkFalse();

            _model.Solver.Assert(ctx.MkOr(num, str));
        }
Example #2
0
        private void AssertTainted([NotNull] IModel sat, [NotNull] string name, Yolol.Execution.Type type)
        {
            Assert.AreEqual(Status.SATISFIABLE, sat.Check());

            foreach (var item in sat.Solver.Model.Consts)
            {
                var vv = sat.Solver.Model.Eval(item.Value);
                Console.WriteLine($"{item.Key.Name} = {vv}");
            }

            var a = sat.TryGetVariable(new VariableName(name));

            Assert.IsNotNull(a, "variable is null");
            Assert.IsFalse(a.IsValueAvailable(), "value is unavailable (tainted)");

            Assert.AreEqual(type == Yolol.Execution.Type.Number, a.CanBeNumber(), "type");
            Assert.AreEqual(type == Yolol.Execution.Type.String, a.CanBeString(), "type");
        }