Example #1
0
        internal void CompareCores(ProtoCore.Core c1, ProtoCore.Core c2, Guid guid)
        {
            for (int symTableIndex = 0; symTableIndex < c1.DSExecutable.runtimeSymbols.Length; symTableIndex++)
            {
                foreach (SymbolNode symNode in c1.DSExecutable.runtimeSymbols[symTableIndex].symbolList.Values)
                {
                    ProtoCore.Mirror.RuntimeMirror langMirror = null;


                    ProtoCore.Mirror.RuntimeMirror dynamoMirror = null;
                    bool lookupOk = false;


                    if (CoreUtils.IsCompilerGenerated(symNode.name) || symNode.functionIndex != Constants.kInvalidIndex)
                    {
                        continue; //Don't care about internal variables
                    }

                    if (symNode.functionIndex == Constants.kGlobalScope && symNode.classScope == Constants.kInvalidIndex)
                    {
                        langMirror = new ProtoCore.Mirror.RuntimeMirror(symNode.name, 0, c1);
                        string name = symNode.name + "_" + guid.ToString();
                        name         = name.Replace("-", string.Empty);
                        dynamoMirror = ViewModel.Model.EngineController.GetMirror(name);
                        if (langMirror != null || dynamoMirror != null)
                        {
                            lookupOk = true;
                        }

                        if (lookupOk)
                        {
                            if (!langMirror.GetData().Equals(dynamoMirror.GetData()))
                            {
                                Assert.Fail(string.Format("\tThe value of variable \"{0}\" doesn't match in language mode and in Dynamo CBN mode.\n", symNode.name));
                            }
                        }
                    }
                }
            }
        }