示例#1
0
        public void CanParseIconsmo()
        {
            string input =
                @"within ModelicaCompliance;

package Icons
  model TestCase
  end TestCase;

  package TestPackage
  end TestPackage;

  annotation(Documentation(info = ""<html></html>""));
end Icons;
            ";
            //
            var ast = parser.ParseProgram(input);

            Assert.NotNull(ast);

            var icons       = ast.ClassDefinitions.First();
            var testCase    = icons.Elements[0] as ClassDefinition;
            var testPackage = icons.Elements[1] as ClassDefinition;
            var annot       = icons.Elements[2] as Annotation;

            Assert.AreEqual("Icons", icons.ID);
            Assert.AreEqual("TestCase", testCase.ID);
            Assert.AreEqual("TestPackage", testPackage.ID);
            //Assert.AreEqual("TestPackage", annot.Modification);
        }
示例#2
0
        public void CanExampleProblemClass()
        {
            string input =
                @"class Ele1000 = Ele(Resistor.r=1000);
                  class Ele
                    class Resistor
                        Real r = 1;
                    end Resistor;
                    class Circuit
                        Resistor r1;
                        Ele.Resistor r2;
                    end Circuit;
                end Ele;";

            var ast = parser.ParseProgram(input);

            Assert.NotNull(ast);
            Assert.AreEqual("Ele1000", ast.ClassDefinitions.First().ID);
            Assert.AreEqual("Ele", ast.ClassDefinitions.Last().ID);
        }