Beispiel #1
0
        public void testSetLength()
        {
            IndexedNumsStream ins = new IndexedNumsStream(600);

            ins.SetLength(500);
            Assert.AreEqual(500, ins.Length);
        }
Beispiel #2
0
        public void ReadTest()
        {
            NumsStream = new IndexedNumsStream(255);

            Assert.IsNotNull(NumsStream);
            Assert.AreEqual(NumsStream.Length, 255);

            NumsStream = new IndexedNumsStream(1000);
            Assert.AreEqual(255, NumsStream.Length);

            NumsStream.SetLength(-500);
            Assert.AreEqual(0, NumsStream.Length);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //Program p = new Program();

            //test NumberedTextWriter
            NumberedTextWriter ntw = new NumberedTextWriter(Console.Out);

            ntw.WriteLine("Hello World!");
            ntw.WriteLine("Hi!");

            //test IndexedNumsStream,
            IndexedNumsStream ins = new IndexedNumsStream(0);

            byte[] buffer = new byte[512];

            ins.SetLength(512);

            ins.Read(buffer, 0, 512);

            foreach (byte num in buffer)
            {
                Console.WriteLine(num);
            }
        }