コード例 #1
0
        public virtual void TestSubPath()
        {
            FacetLabel p = new FacetLabel("hi", "there", "man");

            Assert.AreEqual(p.Length, 3);

            FacetLabel p1 = p.Subpath(2);

            Assert.AreEqual(2, p1.Length);
            Assert.AreEqual("FacetLabel: [hi, there]", p1.ToString());

            p1 = p.Subpath(1);
            Assert.AreEqual(1, p1.Length);
            Assert.AreEqual("FacetLabel: [hi]", p1.ToString());

            p1 = p.Subpath(0);
            Assert.AreEqual(0, p1.Length);
            Assert.AreEqual("FacetLabel: []", p1.ToString());

            // with all the following lengths, the prefix should be the whole path
            int[] lengths = new int[] { 3, -1, 4 };
            for (int i = 0; i < lengths.Length; i++)
            {
                p1 = p.Subpath(lengths[i]);
                Assert.AreEqual(3, p1.Length);
                Assert.AreEqual("FacetLabel: [hi, there, man]", p1.ToString());
                Assert.AreEqual(p, p1);
            }
        }
コード例 #2
0
        public virtual void TestArrayConstructor()
        {
            FacetLabel p = new FacetLabel("hello", "world", "yo");

            Assert.AreEqual(3, p.Length);
            Assert.AreEqual("FacetLabel: [hello, world, yo]", p.ToString());
        }
コード例 #3
0
        public virtual void TestDefaultConstructor()
        {
            // test that the default constructor (no parameters) currently
            // defaults to creating an object with a 0 initial capacity.
            // If we change this default later, we also need to change this
            // test.
            FacetLabel p = new FacetLabel();

            Assert.AreEqual(0, p.Length);
            Assert.AreEqual("FacetLabel: []", p.ToString());
        }