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 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 NumericLimits() { Assert.AreEqual("8.00 EiB", PrettySize.Bytes(long.MaxValue).ToString()); Assert.AreEqual("-8.00 EiB", PrettySize.Bytes(long.MinValue).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)); }