public void WriteRead_First1000()
        {
            for (ulong input = 0; input < 1000; input++)
            {
                var encoded = ThompsonAlphaUnsignedWriter.WriteOneDefault(input);
                var output  = ThompsonAlphaUnsignedReader.ReadOneDefault(encoded);

                Assert.AreEqual(input, output);
            }
        }
Ejemplo n.º 2
0
 public void Read_4_4_4()
 {
     using (var stream = new MemoryStream(BitOperation.ParseToBytes("00001001 00001001 00001001"))) {
         using (var reader = new ThompsonAlphaUnsignedReader(stream)) {
             Assert.AreEqual((ulong)4, reader.Read());
             Assert.AreEqual((ulong)4, reader.Read());
             Assert.AreEqual((ulong)4, reader.Read());
         }
     }
 }
        public void WriteRead_First1000_Appending()
        {
            ulong min = 0;
            ulong max = 1000;

            using (var stream = new MemoryStream()) {
                using (var writer = new ThompsonAlphaUnsignedWriter(stream)) {
                    for (var i = min; i < max; i++)
                    {
                        writer.Write(i);
                    }
                }
                stream.Position = 0;
                using (var reader = new ThompsonAlphaUnsignedReader(stream)) {
                    for (var i = min; i < max; i++)
                    {
                        Assert.AreEqual(i, reader.Read());
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private ulong Read(string input)
 {
     return(ThompsonAlphaUnsignedReader.ReadOneDefault(BitOperation.ParseToBytes(input)));
 }