コード例 #1
0
        public void testJDFIntegerRangeString()
        {
            JDFIntegerRange range = new JDFIntegerRange();

            range = new JDFIntegerRange(" 0 ~ 1 ");

            // rangeList is not empty
            Assert.IsFalse(range.ToString().Length == 0, "Bad Constructor from a given String");
            // must be trasformed into the string "0~1"
            Assert.AreEqual("0 ~ 1", range.ToString(), "Bad Constructor from a given String");
            range = new JDFIntegerRange(" 1 ~ 1 ");
            Assert.AreEqual("1", range.ToString(), "Bad Constructor from a given String");
        }
コード例 #2
0
        public void testAppend()
        {
            JDFIntegerRange range = new JDFIntegerRange(" 0 ~ 1 ");

            // rangeList is not empty
            Assert.IsFalse(range.ToString().Length == 0, "Bad Constructor from a given String");
            // must be trasformed into the string "0~1"
            Assert.AreEqual("0 ~ 1", range.ToString(), "Bad Constructor from a given String");
            Assert.IsFalse(range.Append(4));
            Assert.AreEqual("0 ~ 1", range.ToString(), "Bad Constructor from a given String");
            Assert.IsFalse(range.Append(-5));
            Assert.AreEqual("0 ~ 1", range.ToString(), "Bad Constructor from a given String");
            Assert.IsTrue(range.Append(2));
            Assert.AreEqual("0 ~ 2", range.ToString(), "Bad Constructor from a given String");
            Assert.IsFalse(range.Append(2));
            Assert.AreEqual("0 ~ 2", range.ToString(), "Bad Constructor from a given String");
            Assert.IsFalse(range.Append(1));
            Assert.AreEqual("0 ~ 2", range.ToString(), "Bad Constructor from a given String");
        }
コード例 #3
0
        public void testJDFIntegerRangeListXDef()
        {
            JDFIntegerRange r  = new JDFIntegerRange(1, 2);
            JDFIntegerRange r2 = new JDFIntegerRange(3, -1, 16); // 16 elements

            // element(-1) =
            // 15, range =
            // 3~15

            Assert.IsTrue(r.getElementCount() == 2, "Bad construction of ranges: Range:" + r.ToString());
            Assert.IsTrue(r2.getElementCount() == 13, "Bad construction of ranges with setDef: Range:" + r.ToString());

            JDFIntegerRangeList r3 = new JDFIntegerRangeList(" 1 ~ 2 3 ~ -1 ", 16);

            Assert.IsTrue(r3.getElementCount() == 15, "Bad construction of ranges with setDef: Range:" + r.ToString());
        }