示例#1
0
        public void Combine()
        {
            var          st = new StringTable(0);
            RelativePath p1 = RelativePath.Create(st, "AAA");
            PathAtom     a1 = PathAtom.Create(st, "BBB");
            RelativePath p2 = p1.Combine(a1);

            XAssert.AreEqual(@"AAA\BBB", p2.ToString(st));

            p1 = RelativePath.Create(st, string.Empty);
            p2 = p1.Combine(a1);
            XAssert.AreEqual(@"BBB", p2.ToString(st));

            p1 = RelativePath.Create(st, "AAA");
            PathAtom a2 = PathAtom.Create(st, "CCC");

            p2 = p1.Combine(a1, a2);
            XAssert.AreEqual(@"AAA\BBB\CCC", p2.ToString(st));

            p1 = RelativePath.Create(st, "AAA");
            a2 = PathAtom.Create(st, "CCC");
            PathAtom a3 = PathAtom.Create(st, "DDD");

            p2 = p1.Combine(a1, a2, a3);
            XAssert.AreEqual(@"AAA\BBB\CCC\DDD", p2.ToString(st));

            RelativePath p3 = p1.Combine(p2);

            XAssert.AreEqual(@"AAA\AAA\BBB\CCC\DDD", p3.ToString(st));
        }
        public void Combine()
        {
            var          st = new StringTable(0);
            RelativePath p1 = RelativePath.Create(st, "usr");
            PathAtom     a1 = PathAtom.Create(st, "src");
            RelativePath p2 = p1.Combine(a1);

            XAssert.AreEqual(@"usr/src", p2.ToString(st));

            p1 = RelativePath.Create(st, string.Empty);
            p2 = p1.Combine(a1);
            XAssert.AreEqual(@"src", p2.ToString(st));

            p1 = RelativePath.Create(st, "usr");
            PathAtom a2 = PathAtom.Create(st, "include");

            p2 = p1.Combine(a1, a2);
            XAssert.AreEqual(@"usr/src/include", p2.ToString(st));

            p1 = RelativePath.Create(st, "usr");
            a2 = PathAtom.Create(st, "include");
            PathAtom a3 = PathAtom.Create(st, "x64");

            p2 = p1.Combine(a1, a2, a3);
            XAssert.AreEqual(@"usr/src/include/x64", p2.ToString(st));

            RelativePath p3 = p1.Combine(p2);

            XAssert.AreEqual(@"usr/usr/src/include/x64", p3.ToString(st));
        }
示例#3
0
        public RelativePath CreateRelativePath(RelativePath original, PathAtom atom)
        {
            Contract.Requires(original.IsValid);
            Contract.Requires(atom.IsValid);

            return(original.Combine(atom));
        }
示例#4
0
        public RelativePath CreateRelativePath(RelativePath original, RelativePath path)
        {
            Contract.Requires(original.IsValid);
            Contract.Requires(path.IsValid);

            return(original.Combine(path));
        }
示例#5
0
        public RelativePath CreateRelativePath(RelativePath original, params PathAtom[] atoms)
        {
            Contract.Requires(original.IsValid);
            Contract.Requires(atoms != null);
            Contract.RequiresForAll(atoms, a => a.IsValid);

            return(original.Combine(atoms));
        }
示例#6
0
        public RelativePath CreateRelativePath(RelativePath original, PathAtom atom1, PathAtom atom2)
        {
            Contract.Requires(original.IsValid);
            Contract.Requires(atom1.IsValid);
            Contract.Requires(atom2.IsValid);
            Contract.Ensures(Contract.Result <RelativePath>().IsValid);

            return(original.Combine(atom1, atom2));
        }