public static void AssertPattern(string pattern, ulong value) { Assert.AreEqual(pattern, BitDisplay.ULongToString(value)); }
public void TestDisplayULong() { Assert.AreEqual("00000000 00000000 00000000 00000000 00000000 00000000 00000000 11111111", BitDisplay.ULongToString(255UL)); Assert.AreEqual("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001", BitDisplay.ULongToString(1UL)); Assert.AreEqual("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000010", BitDisplay.ULongToString(1UL << 1)); Assert.AreEqual("00000000 00000000 00000000 00000000 00000000 00000000 00000000 10000000", BitDisplay.ULongToString(1UL << 7)); Assert.AreEqual("00000000 00000000 00000000 00000000 00000000 00000000 10000000 00000000", BitDisplay.ULongToString(1UL << 15)); Assert.AreEqual("00000000 00000000 00000000 00000000 00000000 10000000 00000000 00000000", BitDisplay.ULongToString(1UL << 23)); Assert.AreEqual("00000000 00000000 00000000 00000000 10000000 00000000 00000000 00000000", BitDisplay.ULongToString(1UL << 31)); Assert.AreEqual("00000000 00000000 00000000 10000000 00000000 00000000 00000000 00000000", BitDisplay.ULongToString(1UL << 39)); Assert.AreEqual("00000000 00000000 10000000 00000000 00000000 00000000 00000000 00000000", BitDisplay.ULongToString(1UL << 47)); Assert.AreEqual("00000000 10000000 00000000 00000000 00000000 00000000 00000000 00000000", BitDisplay.ULongToString(1UL << 55)); Assert.AreEqual("10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000", BitDisplay.ULongToString(1UL << 63)); Assert.AreEqual("10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001", BitDisplay.ULongToString(1UL | (1UL << 63))); }