Esempio n. 1
0
 public void ReadsNumberOfRecords()
 {
     BinaryReader br = new BinaryReader(CompressedStream);
     var index = new XZIndex(br, false);
     index.Process();
     Assert.That(index.NumberOfRecords, Is.EqualTo(1));
 }
Esempio n. 2
0
        public void ReadsFirstRecord()
        {
            BinaryReader br    = new BinaryReader(CompressedStream);
            var          index = new XZIndex(br, false);

            index.Process();
            Assert.Equal((ulong)OriginalBytes.Length, index.Records[0].UncompressedSize);
        }
Esempio n. 3
0
        public void ReadsMultipleRecords()
        {
            BinaryReader br    = new BinaryReader(CompressedIndexedStream);
            var          index = new XZIndex(br, false);

            index.Process();
            Assert.Equal((ulong)2, index.NumberOfRecords);
        }
Esempio n. 4
0
        public void ReadsNoRecord()
        {
            BinaryReader br    = new BinaryReader(CompressedEmptyStream);
            var          index = new XZIndex(br, false);

            index.Process();
            Assert.Equal((ulong)0, index.NumberOfRecords);
        }
Esempio n. 5
0
        public void ReadsNumberOfRecords()
        {
            BinaryReader br    = new BinaryReader(CompressedStream);
            var          index = new XZIndex(br, false);

            index.Process();
            Assert.That(index.NumberOfRecords, Is.EqualTo(1));
        }
Esempio n. 6
0
 public void ThrowsIfHasNoIndexMarker()
 {
     using (Stream badStream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 }))
     {
         BinaryReader br    = new BinaryReader(badStream);
         var          index = new XZIndex(br, false);
         Assert.Throws <InvalidDataException>(() => index.Process());
     }
 }
Esempio n. 7
0
 public void SkipsPadding()
 {
     // Index with 3-byte padding.
     using (Stream badStream = new MemoryStream(new byte[] { 0x00, 0x01, 0x10, 0x80, 0x01, 0x00, 0x00, 0x00, 0xB1, 0x01, 0xD9, 0xC9, 0xFF }))
     {
         BinaryReader br    = new BinaryReader(badStream);
         var          index = new XZIndex(br, false);
         index.Process();
         Assert.Equal(0L, badStream.Position % 4L);
     }
 }