Exemplo n.º 1
0
        public void Test_DecodeVWI_Forward()
        {
            uint vli = Mobi.DecodeVWI(new byte[] { 0x99, 0x84, 0x22, 0x11 }, true, out int i);

            Assert.AreEqual((uint)25, vli);
            Assert.AreEqual(1, i);
        }
Exemplo n.º 2
0
        public void MostCommonWordTest()
        {
            const string words    = "two one three one three one";
            const string expected = "one";

            Assert.AreEqual(expected, Mobi.MostCommonWord(words));
        }
Exemplo n.º 3
0
        public void Test_DecodeVWI_Reverse()
        {
            uint vli = Mobi.DecodeVWI(new byte[] { 0x99, 0x84, 0x22, 0x11 }, false, out int i);

            Assert.AreEqual((uint)69905, vli);
            Assert.AreEqual(3, i);
        }
Exemplo n.º 4
0
 public void Test_FormatDate()
 {
     Assert.AreEqual(Mobi.FormatDate("12/31/1999"), "1999-12-31");
 }
Exemplo n.º 5
0
        public void Test_CountBits()
        {
            int bits = Mobi.CountBits((byte)102);

            Assert.AreEqual(bits, 4);
        }
Exemplo n.º 6
0
 public void Test_EncodeVWI_Forward()
 {
     byte[] vli = Mobi.EncodeVWI(69905, true);
     CollectionAssert.AreEqual(vli, new byte[] { 0x4, 0x22, 0x91 });
 }
Exemplo n.º 7
0
 public void Test_EncodeVWI_Reverse()
 {
     byte[] vli = Mobi.EncodeVWI(69905, false);
     CollectionAssert.AreEqual(vli, new byte[] { 0x84, 0x22, 0x11 });
 }