public void Equality() { Assert.AreEqual(PrettySize.KiB(1), PrettySize.Bytes(1024)); Assert.AreEqual(PrettySize.KiB(-1), PrettySize.Bytes(-1024)); Assert.IsTrue(PrettySize.KiB(42) == PrettySize.Kibibytes(42)); Assert.IsTrue(PrettySize.KiB(42) != PrettySize.Kibibytes(43)); }
public void Comparison() { Assert.IsTrue(PrettySize.KiB(1) > PrettySize.KB(1)); Assert.IsTrue(PrettySize.KiB(-2) < PrettySize.Bytes(-1)); Assert.IsTrue(PrettySize.KiB(2) >= PrettySize.KiB(2)); Assert.IsTrue(PrettySize.KiB(2) >= PrettySize.KiB(1)); Assert.IsTrue(PrettySize.KiB(1) <= PrettySize.KiB(2)); Assert.IsTrue(PrettySize.KiB(1) <= PrettySize.KiB(1)); }
public void NegativeSubtraction() { Assert.AreEqual(PrettySize.KiB(4) - PrettySize.KiB(8), PrettySize.KiB(-4)); }
public void Subtraction() { Assert.AreEqual(PrettySize.KiB(4) - PrettySize.KiB(2), PrettySize.KiB(2)); }
public void Addition() { Assert.AreEqual(PrettySize.KiB(4) + PrettySize.KiB(8), PrettySize.KiB(12)); }
public void NegativeSizeFormatting() { Assert.AreEqual("0 bytes", PrettySize.KiB(-0).ToString()); Assert.AreEqual("-1 byte", PrettySize.Bytes(-1).ToString()); Assert.AreEqual("-1.00 KiB", PrettySize.KiB(-1).ToString()); }
public void NegativeSizes() { Assert.AreEqual(-1024, PrettySize.KiB(-1).TotalBytes); Assert.AreEqual(0, PrettySize.KiB(-0).TotalBytes); Assert.AreEqual(PrettySize.KiB(-1), PrettySize.KiB(1) - PrettySize.Bytes(2048)); }