Exemplo n.º 1
0
        public void TestDisplayUInt()
        {
            uint topbit = unchecked ((uint)(1 << 31));

            Assert.AreEqual("00000000 00000000 00000000 11111111", BitDisplay.UIntToString(255));
            Assert.AreEqual("00000000 00000000 00000000 00000001", BitDisplay.UIntToString(1));
            Assert.AreEqual("00000000 00000000 00000000 00000010", BitDisplay.UIntToString(1 << 1));
            Assert.AreEqual("00000000 00000000 00000000 10000000", BitDisplay.UIntToString(1 << 7));
            Assert.AreEqual("00000000 00000000 10000000 00000000", BitDisplay.UIntToString(1 << 15));
            Assert.AreEqual("00000000 10000000 00000000 00000000", BitDisplay.UIntToString(1 << 23));
            Assert.AreEqual("10000000 00000000 00000000 00000000", BitDisplay.UIntToString(topbit));
            Assert.AreEqual("10000000 00000000 00000000 00000001", BitDisplay.UIntToString(1 | topbit));
        }
Exemplo n.º 2
0
 public static void AssertPattern(string pattern, uint value)
 {
     Assert.AreEqual(pattern, BitDisplay.UIntToString(value));
 }