示例#1
0
        public void SimplifyStringTest()
        {
            var assistant = new MemoryAssistant();
            var snapshot  = new Snapshot();

            assistant.InitContext(snapshot);
            var          result = assistant.Simplify(new MemoryEntry(new Value[] { snapshot.AnyStringValue, snapshot.CreateString("a"), snapshot.CreateString("ap") }));
            List <Value> res    = new List <Value>(result.PossibleValues);

            Debug.Assert(res.Count == 1);
            Debug.Assert(res[0] is AnyStringValue);
        }
示例#2
0
        public void SimplifyBoolTest2()
        {
            var assistant = new MemoryAssistant();
            var snapshot  = new Snapshot();

            assistant.InitContext(snapshot);
            var          result = assistant.Simplify(new MemoryEntry(new Value[] { snapshot.CreateBool(false), snapshot.CreateBool(true), snapshot.CreateBool(true) }));
            List <Value> res    = new List <Value>(result.PossibleValues);

            Debug.Assert(res.Count == 1);
            Debug.Assert(res[0] is AnyBooleanValue);
        }
示例#3
0
        public void SimplifyDoubleTest()
        {
            var assistant = new MemoryAssistant();
            var snapshot  = new Snapshot();

            assistant.InitContext(snapshot);
            var          result = assistant.Simplify(new MemoryEntry(new Value[] { snapshot.AnyFloatValue, snapshot.CreateFloatInterval(0, 5) }));
            List <Value> res    = new List <Value>(result.PossibleValues);

            Debug.Assert(res.Count == 1);
            Debug.Assert(res[0] is FloatIntervalValue);
            Debug.Assert((res[0] as FloatIntervalValue).Start == double.MinValue);
            Debug.Assert((res[0] as FloatIntervalValue).End == double.MaxValue);
        }
示例#4
0
        public void SimplifyLongTest()
        {
            var assistant = new MemoryAssistant();
            var snapshot  = new Snapshot();

            assistant.InitContext(snapshot);
            var          result = assistant.Simplify(new MemoryEntry(new Value[] { snapshot.CreateLongintInterval(0, 10), snapshot.CreateLong(-10) }));
            List <Value> res    = new List <Value>(result.PossibleValues);

            Debug.Assert(res.Count == 1);
            Debug.Assert(res[0] is LongintIntervalValue);
            Debug.Assert((res[0] as LongintIntervalValue).Start == -10);
            Debug.Assert((res[0] as LongintIntervalValue).End == 10);
        }
示例#5
0
        public void SimplifyIntTest()
        {
            var assistant = new MemoryAssistant();
            var snapshot  = new Snapshot();

            assistant.InitContext(snapshot);
            var          result = assistant.Simplify(new MemoryEntry(new Value[] { snapshot.CreateInt(0), snapshot.CreateInt(1), snapshot.CreateInt(3), snapshot.CreateInt(4) }));
            List <Value> res    = new List <Value>(result.PossibleValues);

            Debug.Assert(res.Count == 1);
            Debug.Assert(res[0] is IntegerIntervalValue);
            Debug.Assert((res[0] as IntegerIntervalValue).Start == 0);
            Debug.Assert((res[0] as IntegerIntervalValue).End == 4);
        }