Exemplo n.º 1
0
        public void UnwiredSelfTypeNode_Validate_SelfTypeNodeInputTerminalHasUnwiredTerminalError()
        {
            DfirRoot typeDiagram = DfirRoot.Create(CreateTestCompilableDefinitionName("type"));
            var      selfType    = new SelfTypeNode(typeDiagram.BlockDiagram, SelfTypeMode.Struct, 1);

            RunTypeDiagramSemanticAnalysisUpToValidation(typeDiagram);

            AssertTerminalHasRequiredTerminalUnconnectedMessage(selfType.InputTerminals[0]);
        }
Exemplo n.º 2
0
        public void TypeDiagram_InferTypes_DefinedTypeNameMatchesDfirRootName()
        {
            DfirRoot typeDiagram  = DfirRoot.Create(CreateTestCompilableDefinitionName("type"));
            var      selfTypeNode = new SelfTypeNode(typeDiagram.BlockDiagram, SelfTypeMode.Struct, 1);

            ConnectPrimitiveTypeToInputTerminal(selfTypeNode.InputTerminals[0], NITypes.Int32);

            RunSemanticAnalysisUpToTypeInference(typeDiagram);

            NIType selfType = typeDiagram.GetSelfType();

            Assert.AreEqual("type", selfType.GetName());
        }
Exemplo n.º 3
0
        public void PrimitivesIntoSelfVariantType_InferTypes_SelfTypeIsUnionType()
        {
            DfirRoot typeDiagram  = DfirRoot.Create(CreateTestCompilableDefinitionName("type"));
            var      selfTypeNode = new SelfTypeNode(typeDiagram.BlockDiagram, SelfTypeMode.Variant, 2);

            ConnectPrimitiveTypeToInputTerminal(selfTypeNode.InputTerminals[0], NITypes.Int32);
            ConnectPrimitiveTypeToInputTerminal(selfTypeNode.InputTerminals[1], NITypes.Boolean);

            RunSemanticAnalysisUpToTypeInference(typeDiagram);

            NIType selfType = typeDiagram.GetSelfType();

            Assert.IsTrue(selfType.IsUnion());
            Assert.AreEqual(2, selfType.GetFields().Count());
        }
Exemplo n.º 4
0
        public void PrimitiveTypeIntoSelf_InferTypes_SelfTypeIsPrimitiveType()
        {
            DfirRoot typeDiagram  = DfirRoot.Create(CreateTestCompilableDefinitionName("type"));
            var      selfTypeNode = new SelfTypeNode(typeDiagram.BlockDiagram, SelfTypeMode.Struct, 1);

            ConnectPrimitiveTypeToInputTerminal(selfTypeNode.InputTerminals[0], NITypes.Int32);

            RunSemanticAnalysisUpToTypeInference(typeDiagram);

            NIType selfType = typeDiagram.GetSelfType();

            Assert.IsTrue(selfType.IsValueClass());
            Assert.AreEqual(1, selfType.GetFields().Count());
            Assert.IsTrue(selfType.GetFields().ElementAt(0).GetDataType().IsInt32());
        }