string GetFFIObjectStringValue(string dsVariable, int startBlock = 1, int arrayIndex = -1)
        {
            var helper     = DLLFFIHandler.GetModuleHelper(FFILanguage.CSharp);
            var marshaller = helper.GetMarshaller(TestFrameWork.testCore);
            Obj val        = testMirror.GetFirstValue(dsVariable, startBlock);

            ProtoCore.DSASM.StackValue sv;

            if (val.Payload == null)
            {
                return(null);
            }
            else if (val.Payload is DsasmArray)
            {
                DsasmArray arr = val.Payload as DsasmArray;
                Assert.IsTrue((arrayIndex >= 0 && arrayIndex < arr.members.Length), "Invalid array index for FFIObjectOutOfScope verification.");
                sv = arr.members[arrayIndex].DsasmValue;
            }
            else
            {
                sv = val.DsasmValue;
            }

            return(marshaller.GetStringValue(sv));
        }
示例#2
0
 public static void Verify(ExecutionMirror mirror, string dsVariable, object expectedValue, int startBlock = 0)
 {
     try
     {
         Obj dsObj   = mirror.GetFirstValue(dsVariable, startBlock);
         var indices = new List <int>();
         VerifyInternal(expectedValue, dsObj, dsVariable, indices);
     }
     catch (NotImplementedException)
     {
         Assert.Fail(string.Format("\tFailed to get the value of variable {0}\n{1}", dsVariable, mErrorMessage));
     }
 }
示例#3
0
        public void VerifyProperty(ExecutionMirror mirror, string dsVariable, string propertyName, object expectedValue, int startBlock = 0)
        {
            Assert.IsTrue(null != mirror);
            Obj dsObj = mirror.GetFirstValue(dsVariable, startBlock);
            Dictionary <string, Obj> propBag = mirror.GetProperties(dsObj);

            string expression = string.Format("{0}.{1}", dsVariable, propertyName);

            Assert.IsTrue(null != propBag && propBag.TryGetValue(propertyName, out dsObj), string.Format("Property \"{0}\" not found.\n{1}", expression, mErrorMessage));

            var indices = new List <int>();

            VerifyInternal(expectedValue, dsObj, expression, indices);
        }
        public void TestDynamicArray001()
        {
            String code =
                @"
local;
[Imperative]
{
    range = 1..10;
    local = {};
    c = 0;
    for(i in range)
    {
        local[c] = i + 1;
        c = c + 1;
    }
}
";
            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            ProtoCore.Lang.Obj o = mirror.GetFirstValue("local");
            ProtoCore.DSASM.Mirror.DsasmArray arr = (ProtoCore.DSASM.Mirror.DsasmArray)o.Payload;
            Assert.IsTrue((Int64)arr.members[0].Payload == 2);
        }