public void RelativizeTestWin1() { AbsoluteCrosspath xIncludeDirectory = AbsoluteCrosspath.FromString(@"C:\Windows\system32\config"); AbsoluteCrosspath xFile = AbsoluteCrosspath.FromString(@"C:\Program Files (x86)\Common Files\Microsoft"); RelativeCrosspath relPath = xFile.Relativized(xIncludeDirectory); Assert.AreEqual(@"..\..\..\Program Files (x86)\Common Files\Microsoft", relPath.ToString()); }
public void RelativizeTest2() { AbsoluteCrosspath xIncludeDirectory = AbsoluteCrosspath.FromString("/local/store/bin-src/qemu"); AbsoluteCrosspath xFile = AbsoluteCrosspath.FromString("/local/store/fast/bin-src/ccache/ccache.c"); RelativeCrosspath relPath = xFile.Relativized(xIncludeDirectory); Assert.AreEqual("../../fast/bin-src/ccache/ccache.c", relPath.ToString()); }
public void RelativizeTest1() { AbsoluteCrosspath xIncludeDirectory = AbsoluteCrosspath.FromString("/local/store/bin-src/qemu"); AbsoluteCrosspath xFile = AbsoluteCrosspath.FromString("/local/store/bin-src/qemu/hw/mips/serial.c"); RelativeCrosspath relPath = xFile.Relativized(xIncludeDirectory); Assert.AreEqual("hw/mips/serial.c", relPath.ToString()); }
public void RelativizeTest3() { AbsoluteCrosspath xIncludeDirectory = AbsoluteCrosspath.FromString("/local/store/bin-src/qemu"); AbsoluteCrosspath xFile = AbsoluteCrosspath.FromString("/local/store/fast/bin-src/ccache/ccache.c"); try { RelativeCrosspath unused = xFile.Relativized(xIncludeDirectory, true); Assert.Fail("should fail"); } catch (CrosspathLibException) { } }
public void RelativizeTestWin2() { AbsoluteCrosspath xIncludeDirectory = AbsoluteCrosspath.FromString(@"C:\Windows\system32\config"); AbsoluteCrosspath xFile = AbsoluteCrosspath.FromString(@"D:\Games\Call of Duty 2"); try { RelativeCrosspath unused = xFile.Relativized(xIncludeDirectory); Assert.Fail("should fail"); } catch { // ignored } }