コード例 #1
0
ファイル: JDFTestTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testFitsContext()
        {
            JDFDoc  d = new JDFDoc(ElementName.TEST);
            JDFTest t = (JDFTest)d.getRoot();

            t.init();
            t.setContext("//JDF");
            JDFDoc  jdf  = new JDFDoc(ElementName.JDF);
            JDFNode node = jdf.getJDFRoot();

            node.setType(EnumType.ProcessGroup);
            JDFNode     node2 = node.addJDFNode("foobar");
            JDFResource r2    = node.addResource("res", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);

            Assert.IsTrue(t.fitsContext(node));
            Assert.IsTrue(t.fitsContext(node2));
            t.setContext("JDF");
            Assert.IsTrue(t.fitsContext(node));
            Assert.IsTrue(t.fitsContext(node2));
            t.setContext("/JDF");
            Assert.IsTrue(t.fitsContext(node));
            Assert.IsFalse(t.fitsContext(node2));
            t.setContext("res");
            Assert.IsTrue(t.fitsContext(r2));
            t.setContext("/res");
            Assert.IsFalse(t.fitsContext(r2));
        }
コード例 #2
0
ファイル: JDFTestTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testValidTest1()
        {
            JDFDoc  d = new JDFDoc(ElementName.TEST);
            JDFTest t = (JDFTest)d.getRoot();

            t.init();
            t.appendTerm(EnumTerm.IsPresentEvaluation);
            Assert.IsTrue(t.isValid(EnumValidationLevel.Complete));
            t.appendTerm(EnumTerm.BooleanEvaluation); // no two are allowed
            Assert.IsFalse(t.isValid(EnumValidationLevel.Complete));
        }
コード例 #3
0
        public void testFitsTolerance()
        {
            try
            {
                new JDFXYPairRangeList("0.4 1.9~1.4 2.9 0.4 1.9~2.4 3.8 0.4 1.6");

                JDFDoc  d = new JDFDoc(ElementName.TEST);
                JDFTest t = (JDFTest)d.getRoot();
                t.init();
                JDFXYPairEvaluation xyPairEvaluation = (JDFXYPairEvaluation)t.appendTerm(EnumTerm.XYPairEvaluation);
                xyPairEvaluation.setTolerance(new JDFXYPair("0 0"));
                Assert.IsTrue(t.isValid(EnumValidationLevel.Complete));

                Assert.AreEqual(new JDFXYPair("0 0"), xyPairEvaluation.getTolerance());
                xyPairEvaluation.setTolerance(new JDFXYPair("0.1 0.1"));
            }
            catch (FormatException dfe)
            {
                Assert.Fail(dfe.ToString());
            }
        }